Esempio n. 1
0
 void OnSelectedIndexChanged(object sender, EventArgs e)
 {
     if (!this.addingFile && this.RecentFileSelected != null)
     {
         ComboFileItem item = this.location.SelectedItem as ComboFileItem;
         if (item != null)
         {
             this.RecentFileSelected(sender, new RecentFileEventArgs(item.Location));
         }
     }
 }
Esempio n. 2
0
 void OnSelectedIndexChanged(object sender, EventArgs e)
 {
     if (!this.addingFile)
     {
         ComboFileItem item = this._location.SelectedItem as ComboFileItem;
         if (item != null)
         {
             this._files.OnRecentFileSelected(item.Location);
         }
     }
 }
Esempio n. 3
0
        void SyncRecentFilesUI()
        {
            // Synchronize menu items.
            this.parent.Enabled = true;
            this.addingFile     = true;

            try
            {
                ToolStripItemCollection ic = this.parent.DropDownItems;
                ic.Clear();

                // Add most recent files first.
                for (int i = this.recentFiles.Count - 1, j = 0; i >= 0 && j < maxRecentMenuFiles; i--, j++)
                {
                    Uri           uri  = this.recentFiles[i];
                    ToolStripItem item = new ToolStripMenuItem();
                    item.Click += new EventHandler(OnRecentFile);
                    ic.Add(item);
                    item.Text = uri.IsFile ? uri.LocalPath : uri.AbsoluteUri;
                    item.Tag  = uri;
                }

                // Synchronize combo-box items
                this.location.Items.Clear();
                for (int i = this.recentFiles.Count - 1; i >= 0; i--)
                {
                    Uri uri = this.recentFiles[i];
                    this.location.Items.Add(new ComboFileItem(uri));
                }

                if (this.location.Items.Count > 0)
                {
                    this.location.SelectedIndex = 0;
                }

                // sync autocompletion list
                this.location.AutoCompleteCustomSource.Clear();
                for (int i = 0; i < this.location.Items.Count; i++)
                {
                    ComboFileItem item = (ComboFileItem)this.location.Items[i];
                    this.location.AutoCompleteCustomSource.Add(item.ToString());
                }
            }
            finally
            {
                this.addingFile = false;
            }
        }
Esempio n. 4
0
 void OnLocationKeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         // user has entered something new?
         e.Handled          = true;
         e.SuppressKeyPress = true;
         ComboFileItem item = this.location.SelectedItem as ComboFileItem;
         if (item != null)
         {
             this.RecentFileSelected(sender, new RecentFileEventArgs(item.Location));
         }
     }
     else if (e.KeyCode == Keys.Escape)
     {
         this.location.DroppedDown = false;
     }
 }
Esempio n. 5
0
        private void OnRecentFilesChanged(object sender, EventArgs e)
        {
            // Synchronize menu items.
            this.addingFile = true;

            try
            {
                // Add most recent files first.
                Uri[] recentFiles = this._files.GetRelativeUris();

                // Synchronize combo-box items
                this._location.Items.Clear();
                for (int i = recentFiles.Length - 1; i >= 0; i--)
                {
                    Uri uri = recentFiles[i];
                    this._location.Items.Add(new ComboFileItem(uri));
                }

                if (this._location.Items.Count > 0 && this.SelectFirstItemByDefault)
                {
                    this._location.SelectedIndex = 0;
                }

                // sync autocompletion list
                this._location.AutoCompleteCustomSource.Clear();
                for (int i = 0; i < this._location.Items.Count; i++)
                {
                    ComboFileItem item = (ComboFileItem)this._location.Items[i];
                    this._location.AutoCompleteCustomSource.Add(item.ToString());
                }
            }
            finally
            {
                this.addingFile = false;
            }
        }