示例#1
0
        private void b_Click(object sender, EventArgs e)
        {
            GUI_Controls.GUIButton b = sender as GUI_Controls.GUIButton;
            if (b == null)
            {
                return;
            }

            string msg = b.Tag as string;

            if (string.IsNullOrEmpty(msg))
            {
                return;
            }

            GUI_Controls.RoboMessagePanel prompt = new GUI_Controls.RoboMessagePanel(RoboSep_UserConsole.getInstance(), MessageIcon.MBICON_INFORMATION, msg, String.Empty);
            RoboSep_UserConsole.showOverlay();
            prompt.ShowDialog();
            prompt.Dispose();
            RoboSep_UserConsole.hideOverlay();
            return;
        }
示例#2
0
        public void refreshList(Dictionary <string, PreferenceSettings> dictSettings)
        {
            if (dictSettings == null)
            {
                return;
            }

            this.listView_UserPref.ItemChecked -= new System.Windows.Forms.ItemCheckedEventHandler(this.listView_UserPref_HandleItemChecked);

            listView_UserPref.SuspendLayout();
            listView_UserPref.Items.Clear();
            if (dictSettings.Count > 0)
            {
                ListViewItem lvItem;
                ListViewItem.ListViewSubItem lvSubItem;
                IDictionaryEnumerator        aEnumerator = dictSettings.GetEnumerator();
                while (aEnumerator.MoveNext())
                {
                    PreferenceSettings s   = (PreferenceSettings)aEnumerator.Value;
                    string             key = (string)aEnumerator.Key;

                    // Sunny to do
                    lvItem         = new ListViewItem();
                    lvSubItem      = new ListViewItem.ListViewSubItem();
                    lvItem.Tag     = key;
                    lvItem.Text    = dictSettings[key].displayName;
                    lvItem.Checked = dictSettings[key].value;
                    lvSubItem.Tag  = dictSettings[key].helpString;
                    lvItem.SubItems.Add(lvSubItem);
                    listView_UserPref.Items.Add(lvItem);
                }

                aEnumerator = dictSettings.GetEnumerator();
                while (aEnumerator.MoveNext())
                {
                    PreferenceSettings s   = (PreferenceSettings)aEnumerator.Value;
                    string             key = (string)aEnumerator.Key;

                    // Add help button
                    GUI_Controls.GUIButton b = new GUI_Controls.GUIButton();
                    b.Size = new Size(BUTTON_SIZE, BUTTON_SIZE);

                    List <Image> ilist = new List <Image>();
                    ilist.Clear();
                    ilist.Add(Properties.Resources.PF_BTN01S_details_STD);
                    ilist.Add(Properties.Resources.PF_BTN01S_details_OVER);
                    ilist.Add(Properties.Resources.PF_BTN01S_details_OVER);
                    ilist.Add(Properties.Resources.PF_BTN01S_details_CLICK);
                    b.ChangeGraphics(ilist);

                    b.Tag    = dictSettings[key].helpString;
                    b.Click += new EventHandler(b_Click);

                    for (int i = 0; i < listView_UserPref.Items.Count; i++)
                    {
                        ListViewItem lvItemTemp = listView_UserPref.Items[i];
                        string       temp       = lvItemTemp.Tag as string;
                        if (temp == key)
                        {
                            // Put it in the second column of every row
                            listView_UserPref.AddEmbeddedControl(b, 1, lvItemTemp.Index);
                            break;
                        }
                    }
                }
            }

            this.listView_UserPref.ItemChecked += new System.Windows.Forms.ItemCheckedEventHandler(this.listView_UserPref_HandleItemChecked);
            listView_UserPref.ResumeLayout(true);
        }