Exemple #1
0
        private void OpenFile()
        {
            if (DialogResult.OK == this.openFileDialog.ShowDialog())
            {
                Cursor.Current = Cursors.WaitCursor;

                this.productsListView.Items.Clear();
                this.webBrowser.Visible = false;
                this.panel.Visible      = false;

                try
                {
                    KeysCollection collection = new KeysCollection(this.openFileDialog.FileName);
                    this._dict = collection.Keys;

                    foreach (Guid key in _dict.Keys)
                    {
                        // Get the actual data we care about
                        MsdnKey val = _dict[key];

                        // Create a new ListViewItem for this product
                        ListViewItem item = new ListViewItem(val.Name);
                        item.Tag = key;

                        // Add the item to the ListView
                        this.productsListView.Items.Add(item);
                    }
                }
                catch (FileNotFoundException)
                {
                    MessageBox.Show("File " + this.openFileDialog.FileName + " does not exist.", "KeysExport Viewer", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly);
                }

                Cursor.Current = Cursors.Default;
            }
        }
        private void OpenFile()
        {
            if (DialogResult.OK == this.openFileDialog.ShowDialog())
            {
                Cursor.Current = Cursors.WaitCursor;

                this.productsListView.Items.Clear();
                this.webBrowser.Visible = false;
                this.panel.Visible = false;

                try
                {
                    KeysCollection collection = new KeysCollection(this.openFileDialog.FileName);
                    this._dict = collection.Keys;

                    foreach (Guid key in _dict.Keys)
                    {
                        // Get the actual data we care about
                        MsdnKey val = _dict[key];

                        // Create a new ListViewItem for this product
                        ListViewItem item = new ListViewItem(val.Name);
                        item.Tag = key;

                        // Add the item to the ListView
                        this.productsListView.Items.Add(item);
                    }
                }
                catch (FileNotFoundException)
                {
                    MessageBox.Show("File " + this.openFileDialog.FileName + " does not exist.", "KeysExport Viewer", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly);
                }

                Cursor.Current = Cursors.Default;
            }
        }