コード例 #1
0
        // We can change the current path using the Menu
        void pathStepMenuItemClicked(object sender, EventArgs e)
        {
            MenuItemWithTag <string> menuItem = sender as MenuItemWithTag <string>;

            if (menuItem != null)
            {
                //Only do this if the view is not being updated
                if (!updating)
                {
                    //1) Change to the new directory
                    ChangeDirectory(menuItem.Tag);
                }
            }
        }
コード例 #2
0
 private void BackKeyPress(object sender, EventArgs e)
 {
     if (menuItem1.Enabled)
     {
         // Determine the path to the parent directory
         // and update the dialog
         MenuItemWithTag <string> mnu = (MenuItemWithTag <string>)softKey2Menu.MenuItems[softKey2Menu.MenuItems.Count - 2];
         ChangeDirectory(mnu.Tag);
     }
     else
     {
         // Cancel the dialog
         DialogResult = DialogResult.Cancel;
         this.Close();
     }
 }
コード例 #3
0
        // Refill the Combo box and Menu with the path
        // step by step
        private void UpdateSelector()
        {
            // Remove the existing menu items and combo
            // box entries
            softKey2Menu.MenuItems.Clear();
            PathSelectorComboBox.Items.Clear();

            // Split directories
            string[] pathParts = (currentPath == ROOT ? string.Empty : currentPath).Split(Path.DirectorySeparatorChar);

            // Build new items
            MenuItemWithTag <string> newItem;
            string partialPath = string.Empty;

            foreach (string part in pathParts)
            {
                newItem = new MenuItemWithTag <string>();
                if (part == string.Empty)
                {
                    newItem.Text = "\\";
                }
                else
                {
                    newItem.Text = part;
                }
                newItem.Click += new EventHandler(pathStepMenuItemClicked);
                partialPath    = Path.Combine(partialPath, newItem.Text);

                newItem.Tag = partialPath;

                softKey2Menu.MenuItems.Add(newItem);
                PathSelectorComboBox.Items.Add(newItem.Text);
            }

            // Disable the "Up" softkey (and back key) if
            // we are in the root directory.
            menuItem1.Enabled = (softKey2Menu.MenuItems.Count > 1);

            // Select the current item in the combo box
            PathSelectorComboBox.SelectedIndex = pathParts.Length - 1;
        }
コード例 #4
0
        //UP
        //Go to the parent folder by softkey1
        private void menuItem1_Click(object sender, EventArgs e)
        {
            MenuItemWithTag <string> menuItem = (MenuItemWithTag <string>)softKey2Menu.MenuItems[softKey2Menu.MenuItems.Count - 2];

            ChangeDirectory(menuItem.Tag);
        }