/// <summary>
        /// Handles the click event on the select button :
        ///   - stores the selected dictionary
        ///   - close the window
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void selectButton_Click(object sender, EventArgs e)
        {
            Selected = null;

            ListBoxEntry selected = dataDictionaryListBox.SelectedItem as ListBoxEntry;

            if (selected != null)
            {
                Selected = selected.Dictionary;
            }

            Close();
        }
 public void importShortcuts()
 {
     listBoxFavs.Items.Clear();
     if (Directory.Exists(userDataFolder))
     {
         ListBoxEntry entryMain = new ListBoxEntry();
         entryMain.title = mainTitle;
         entryMain.url = mainUrl;
         listBoxFavs.Items.Add(entryMain);
         String shortcutFolder = userDataFolder + "\\shortcuts";
         if (!Directory.Exists(shortcutFolder))
         {
             Directory.CreateDirectory(shortcutFolder);
         }
         else
         {
             String filename = userDataFolder + "\\shortcuts\\" + mainTitle + ".links";
             if (File.Exists(filename))
             {
                 StreamReader str = new StreamReader(filename);
                 String line;
                 while ((line = str.ReadLine()) != null)
                 {
                     if (line.Contains("="))
                     {
                         String entry = line.Substring(0, line.IndexOf("="));
                         String content = line.Substring(line.IndexOf("=") + 1);
                         ListBoxEntry listBoxEntry = new ListBoxEntry();
                         listBoxEntry.title = entry.Trim();
                         listBoxEntry.url = content.Trim();
                         listBoxFavs.Items.Add(listBoxEntry);
                     }
                 }
                 str.Close();
             }
         }
         ListBoxEntry entryNew = new ListBoxEntry();
         entryNew.title = "- Add Current URL";
         listBoxFavs.Items.Add(entryNew);
         listBoxFavs.SelectedIndex = 0;
     }
     int height = 110;
     if (listBoxFavs.Items.Count > 1)
         height = listBoxFavs.Items.Count * 55 + 50;
     if (height >= 720)
         height = 720;
     this.Size = new Size(this.Size.Width, height);
 }
Exemplo n.º 3
0
        protected override Control GetEditControl(string PropName, object CurrentValue, object CurrentObj)
        {
            ListBoxValueCollection col = new ListBoxValueCollection();
            //Aaron added 11/11/2013
            //Object wrapper is a wrapper object used to show categories in the grid
            //We need to extract the button object from the wrapper
            ObjectWrapper placeHolder = CurrentObj as ObjectWrapper;
            CtrlListBox   rg          = placeHolder.SelectedObject as CtrlListBox;

            //Aaron added 11/11/2013
            //Commented code below
            //  BSkyRadioGroup rg = CurrentObj as BSkyRadioGroup;
            if (string.IsNullOrEmpty(rg.Name))
            {
                MessageBox.Show(BSky.GlobalResources.Properties.Resources.EnterValidValue);
                return(null);
            }

            //Aaron 05/05/2013
            //Did not change code only added comment below
            //This launches the radio group editor window that allows the use to enter details about the radio group

            ListBoxEditorWindow w = new ListBoxEditorWindow();

            //StackPanel sp = rg.Content as StackPanel;
            //Added by Aaron 05/05/2013
            //Did not change code only added comment below
            //If there were existing radio buttons, the code below populates the windows with existing radio buttons
            foreach (string obj in rg.Items)
            {
                ListBoxEntry entry = new ListBoxEntry();
                entry.entryName = obj;

                col.Add(entry);
            }
            //Added by Aaron 05/05/2013
            //Did not change code only added comment below
            //the line below adds the BSkyRadioButtonCollection to the observable collection of radio buttons
            //public ObservableCollection<BSkyRadioButton> RadioCollection
            //The observable collection is populated in the setter of
            w.ListBoxEntries = col;
            //Aaron 12/26 ADDED AND commented lines below
            // rg.RadioButtons = col;
            return(w);
        }
 public FormFavourites(String userDataFolder)
 {
     InitializeComponent();
     if (Directory.Exists(userDataFolder))
     {
         DirectoryInfo dir = new DirectoryInfo(userDataFolder + "\\sites");
         foreach (FileInfo file in dir.GetFiles())
         {
             if (file.FullName.EndsWith(".link"))
             {
                 ListBoxEntry listBoxEntry = new ListBoxEntry();
                 StreamReader str = new StreamReader(file.FullName);
                 String line;
                 while ((line = str.ReadLine()) != null)
                 {
                     if (line.Contains("="))
                     {
                         String entry = line.Substring(0, line.IndexOf("="));
                         String content = line.Substring(line.IndexOf("=")+1);
                         if (entry == "title")
                             listBoxEntry.title = content.Trim();
                         else if (entry == "url")
                             listBoxEntry.url = content.Trim();
                     }
                 }
                 str.Close();
                 listBoxFavs.Items.Add(listBoxEntry);
             }
         }
         if (listBoxFavs.Items.Count > 0)
             listBoxFavs.SelectedIndex = 0;
     }
     int height = 110;
     if (listBoxFavs.Items.Count > 1)
         height = listBoxFavs.Items.Count * 55 + 50;
     if (height >= 720)
         height = 720;
     this.Size = new Size(this.Size.Width, height);
 }
 public FormContextMenu()
 {
     InitializeComponent();
     ListBoxEntry listBoxEntry = new ListBoxEntry();
     listBoxEntry.title = "Enter URL";
     listBoxMenu.Items.Add(listBoxEntry);
     listBoxEntry = new ListBoxEntry();
     listBoxEntry.title = "Show Keyboard";
     listBoxMenu.Items.Add(listBoxEntry);
     listBoxEntry = new ListBoxEntry();
     listBoxEntry.title = "Show Magnifier";
     listBoxMenu.Items.Add(listBoxEntry);
     listBoxEntry = new ListBoxEntry();
     listBoxEntry.title = "Show Favourites";
     listBoxMenu.Items.Add(listBoxEntry);
     listBoxEntry = new ListBoxEntry();
     listBoxEntry.title = "Show Shortcuts";
     listBoxMenu.Items.Add(listBoxEntry);
     listBoxEntry = new ListBoxEntry();
     listBoxEntry.title = "Double Click";
     listBoxMenu.Items.Add(listBoxEntry);
     listBoxEntry = new ListBoxEntry();
     listBoxEntry.title = "Press TAB";
     listBoxMenu.Items.Add(listBoxEntry);
     listBoxEntry = new ListBoxEntry();
     listBoxEntry.title = "Press ESC";
     listBoxMenu.Items.Add(listBoxEntry);
     listBoxEntry = new ListBoxEntry();
     listBoxEntry.title = "Press F5";
     listBoxMenu.Items.Add(listBoxEntry);
     if (listBoxMenu.Items.Count > 0)
         listBoxMenu.SelectedIndex = 0;
     int height = 110;
     if (listBoxMenu.Items.Count > 1)
         height = listBoxMenu.Items.Count * 55 + 50;
     if (height >= 720)
         height = 720;
     this.Size = new Size(this.Size.Width, height);
 }
Exemplo n.º 6
0
                /// <summary>
                /// Removes the instance currently selected in the instance list when invoked.
                /// </summary>
                private void RemoveSelectedInstance(object sender, EventArgs args)
                {
                    if (instanceList.Selection != null)
                    {
                        ListBoxEntry <TestWindowNode> selection = instanceList.Selection;
                        TestWindowNode testNode           = selection.AssocMember;
                        var            instanceCollection = instanceList.HudCollection;

                        int index = instanceCollection.FindIndex(x => x.AssocMember == testNode);
                        instanceList.RemoveAt(index);
                        testNode.Unregister();

                        // Attempt to select the previous member
                        if (index > 0)
                        {
                            index--;
                        }

                        if (instanceCollection.Count > 0)
                        {
                            instanceList.SetSelectionAt(index);
                        }
                    }
                }
Exemplo n.º 7
0
 public void SetSelection(ListBoxEntry <T> entry) =>
 dropdown.SetSelection(entry);
Exemplo n.º 8
0
 public void SetSelection(ListBoxEntry <T> entry) =>
 listBox.SetSelection(entry);