public TrayIcon()
        {
            components = new System.ComponentModel.Container();
            notifyIcon = new NotifyIcon(this.components);
            RenderIcon(255, 0);
            notifyIcon.Visible     = true;
            contextMenu            = new ContextMenu();
            notifyIcon.ContextMenu = contextMenu;

            MenuItem_BIOS = new ProfileMenuItem(new FanProfile()
            {
                Name = "BIOS", IsBIOS = true, Interval = Config.General.interval
            });
            MenuItem_BIOS.Click += HandleProfileMenuItemClick;

            MenuItem_ConfigFile        = new MenuItem("Create " + Configuration.DefaultConfigFileName);
            MenuItem_ConfigFile.Click += HandleCreateConfigFileEvent;

            MenuItem_Exit        = new MenuItem("Exit");
            MenuItem_Exit.Click += (sender, e) => { notifyIcon.Visible = false; Application.Exit(); };

            StandardMenuItems = new [] { new MenuItem("-"),
                                         MenuItem_BIOS,
                                         new MenuItem("-"),
                                         MenuItem_ConfigFile,
                                         new MenuItem("-"),
                                         MenuItem_Exit };
        }
        public void RebuildMenuItems()
        {
            contextMenu.MenuItems.Clear();

            FanProfile selected = null;

            for (int i = 0, len = Config.AllProfiles.Length; i < len; i++)
            {
                FanProfile      profile  = Config.AllProfiles[i];
                ProfileMenuItem menuItem = new ProfileMenuItem(profile);
                menuItem.Click += HandleProfileMenuItemClick;
                contextMenu.MenuItems.Add(menuItem);
                if (profile.IsDefault && selected == null)
                {
                    menuItem.Checked = true;
                    selected         = profile;
                }
            }

            for (int i = 0, len = StandardMenuItems.Length; i < len; i++)
            {
                contextMenu.MenuItems.Add(StandardMenuItems[i]);
            }

            Program.Regulator.RunProfile(selected ?? MenuItem_BIOS.Profile);
        }
        private void HandleProfileMenuItemClick(Object sender, EventArgs ev)
        {
            for (int i = 0, len = contextMenu.MenuItems.Count; i < len; i++)
            {
                if (contextMenu.MenuItems[i] is ProfileMenuItem item)
                {
                    item.Checked = false;
                }
            }
            ProfileMenuItem pmi = (ProfileMenuItem)sender;

            pmi.Checked = true;
            Program.Regulator.RunProfile(pmi.Profile);
        }
示例#4
0
    public void UpdateFocusedItem(ProfileMenuItem item)
    {
        if (item == focusedItem)
        {
            return;
        }

        if (focusedItem)
        {
            focusedItem.UnFocus();
            //infoTextAnim.Play("a_FadeOut");
        }

        focusedItem = item;
        focusedItem.Focus();
    }
示例#5
0
    public void setProfile(Profile profile)
    {
        foreach (Transform child in content.transform)
        {
            Destroy(child.gameObject);
        }
        foreach (Statistic stat in profile.getAllStatistics())
        {
            GameObject item = Instantiate(profile_menu_item_prefab);
            item.transform.SetParent(content.transform, false);

            ProfileMenuItem item_script = item.GetComponent <ProfileMenuItem>();
            item_script.setStatistic(stat);

            item.SetActive(true);
        }
    }
示例#6
0
        async Task ResumeAfterChoiceAsync(IDialogContext context, IAwaitable <ProfileMenuItem> result)
        {
            ProfileMenuItem choice = await result;

            switch (choice)
            {
            case ProfileMenuItem.Display:
                await DisplayAsync(context);

                break;

            case ProfileMenuItem.Update:
                await UpdateAsync(context);

                break;

            case ProfileMenuItem.Done:
            default:
                context.Done(this);
                break;
            }
        }