Exemple #1
0
        public SelectWMIClassTreeDialog(string server,
                                        string connectAsIn,
                                        string passwordIn,
                                        ClassFilters filters,
                                        ArrayList selClasses
                                        /*TODO: credentials */
                                        )

        {
            try
            {
                currentFilters  = filters;
                machineName     = server;
                selectedClasses = selClasses;
                connectAs       = connectAsIn;
                password        = passwordIn;

                this.Text              = WMISys.GetString("WMISE_ClassSelectorLbl");
                this.AcceptButton      = okBtn;
                this.AutoScaleBaseSize = (Size) new Point(5, 13);
                this.BorderStyle       = FormBorderStyle.FixedDialog;
                this.CancelButton      = cancelBtn;
                int dlgWidth  = 527;
                int dlgHeight = 480;
                this.ClientSize = (Size) new Point(dlgWidth, dlgHeight);
                //this.add_KeyUp(new KeyEventHandler(this.OnKeyUp));
                this.ShowInTaskbar = false;
                this.MinimizeBox   = false;
                this.MaximizeBox   = false;

                labelSearch.Location = new Point(16, 16);
                labelSearch.Size     = (Size) new Point(200, 13);
                labelSearch.TabStop  = false;
                labelSearch.Text     = WMISys.GetString("WMISE_ClassSelectorLblSearch");

                editSearch.Location      = new Point(16, 33);
                editSearch.Size          = (Size) new Point(200, 20);
                editSearch.TabStop       = true;
                editSearch.TextChanged  += new EventHandler(this.SearchPattern_changed);
                editSearch.AcceptsReturn = true;                         //???
                editSearch.TabIndex      = 0;

                btnGo.Location = new Point(226, 33);
                btnGo.TabStop  = true;
                btnGo.Text     = WMISys.GetString("WMISE_ClassSelectorBtnSearch");
                btnGo.Click   += new EventHandler(this.Search_click);

                classList = new WMIClassTreeView(machineName,
                                                 connectAs,
                                                 password,
                                                 currentFilters,
                                                 null);

                classList.Location        = new Point(16, 63);
                classList.Size            = (Size) new Point(200, 270);
                classList.ShowPlusMinus   = true;
                classList.ShowLines       = true;
                classList.DoubleClick    += (new EventHandler(this.Add_click));
                classList.BeforeCollapse += (new TreeViewCancelEventHandler(this.BeforeNodeCollapse));
                classList.AfterSelect    += (new TreeViewEventHandler(this.AfterNodeSelect));
                classList.KeyUp          += (new KeyEventHandler(this.OnTreeKeyUp));
                classList.HideSelection   = false;
                classList.FullRowSelect   = true;


                //Image symbols = Image.FromFile("symbols.bmp");
                //imgList.Images.AddStrip(symbols);

                imgList.TransparentColor = defaultBackColor;                         //didn't help!!!!!!!

                imgList.Images.Add((Image) new Bitmap(GetType(), "closed_fol.bmp"), defaultBackColor);
                imgList.Images.Add((Image) new Bitmap(GetType(), "open_fol.bmp"), defaultBackColor);

                imgList.Images.Add((Image) new Bitmap(GetType(), "class.bmp"), defaultBackColor);
                imgList.Images.Add((Image) new Bitmap(GetType(), "classassoc.bmp"), defaultBackColor);

                imgList.Images.Add((Image) new Bitmap(GetType(), "abstr1.bmp"), defaultBackColor);
                imgList.Images.Add((Image) new Bitmap(GetType(), "abstr2.bmp"), defaultBackColor);
                imgList.Images.Add((Image) new Bitmap(GetType(), "abstr_assoc1.bmp"), defaultBackColor);                         //SCHEMA_ASSOC_ABSTRACT1
                imgList.Images.Add((Image) new Bitmap(GetType(), "abstr_assoc2.bmp"), defaultBackColor);                         //SCHEMA_ASSOC_ABSTRACT2


                btnAdd.Location = new Point(226, 150);
                btnAdd.TabStop  = true;
                btnAdd.Text     = WMISys.GetString("WMISE_ClassSelectorBtnAdd");
                btnAdd.Click   += new EventHandler(this.Add_click);
                btnAdd.Enabled  = false;

                btnRemove.Location = new Point(226, 200);
                btnRemove.TabStop  = true;
                btnRemove.Text     = WMISys.GetString("WMISE_ClassSelectorBtnRemove");
                btnRemove.Click   += new EventHandler(this.Remove_click);
                btnRemove.Enabled  = false;

                labelSelected.Location = new Point(311, 43);
                labelSelected.Size     = (Size) new Point(200, 20);
                labelSelected.TabStop  = false;
                labelSelected.Text     = WMISys.GetString("WMISE_ClassSelectorSelClassesLbl");

                selectedClassList.Location      = new Point(311, 63);
                selectedClassList.Size          = (Size) new Point(200, 270);
                selectedClassList.SelectionMode = SelectionMode.MultiExtended;
                selectedClassList.Sorted        = true;
                //initialize selected class list
                String[] arSel = new String[selectedClasses.Count];
                selectedClasses.CopyTo(arSel, 0);
                for (int i = 0; i < arSel.Length; i++)
                {
                    selectedClassList.Items.Add(arSel[i]);
                }


                selectedClassList.Click       += new EventHandler(this.AfterClassSelect);
                selectedClassList.KeyUp       += new KeyEventHandler(this.OnClassListKeyUp);
                selectedClassList.DoubleClick += (new EventHandler(this.Remove_click));

/*
 *                                      chkShowData.Checked = ((currentFilters & SchemaFilters.NoData) == 0);
 *                                      chkShowData.Location = new Point(500, 370);
 *                                      chkShowData.Text = "Data";
 *                                      chkShowData.Click += new EventHandler(this.Filter_click);
 *                                      chkShowData.Visible = false;
 *
 *                                      chkShowSystem.Checked = ((currentFilters & SchemaFilters.NoSystem) == 0);
 *                                      chkShowSystem.Location = new Point(550, 370);
 *                                      chkShowSystem.Text = "System";
 *                                      chkShowSystem.Click += new EventHandler(this.Filter_click);
 *                                      chkShowSystem.Visible = false;
 *
 *                                      chkShowEvent.Checked = ((currentFilters & SchemaFilters.NoEvent) == 0);
 *                                      chkShowEvent.Location = new Point(500, 400);
 *                                      chkShowEvent.Text = "Event";
 *                                      chkShowEvent.Click += new EventHandler(this.Filter_click);
 *                                      chkShowEvent.Visible = false;
 *
 *                                      chkShowAbstract.Checked = ((currentFilters & SchemaFilters.NoAbstract) == 0);
 *                                      chkShowAbstract.Location = new Point( 550, 400);
 *                                      chkShowAbstract.Text = "Abstract";
 *                                      chkShowAbstract.Click += new EventHandler(this.Filter_click);
 *                                      chkShowAbstract.Visible = false;
 */
                descr.Text       = "";
                descr.Location   = new Point(16, 342);
                descr.Size       = (Size) new Point(500, 75);
                descr.Multiline  = true;
                descr.ReadOnly   = true;
                descr.ScrollBars = ScrollBars.Vertical;

                okBtn.Text         = WMISys.GetString("WMISE_OK");
                okBtn.TabIndex     = 1;
                okBtn.Location     = new Point(350, 427);
                okBtn.DialogResult = DialogResult.OK;
                okBtn.Click       += new EventHandler(this.OK_click);

                cancelBtn.Text         = WMISys.GetString("WMISE_Cancel");
                cancelBtn.TabIndex     = 2;
                cancelBtn.Location     = new Point(436, 427);
                cancelBtn.DialogResult = DialogResult.Cancel;

                this.Controls.Add(cancelBtn);
                this.Controls.Add(okBtn);
                this.Controls.Add(classList);
                this.Controls.Add(selectedClassList);
                //chkShowAbstract,
                //chkShowSystem,
                //chkShowEvent,
                //chkShowData,
                this.Controls.Add(labelSearch);
                this.Controls.Add(labelSelected);
                this.Controls.Add(editSearch);
                this.Controls.Add(btnGo);
                this.Controls.Add(btnAdd);
                this.Controls.Add(btnRemove);
                this.Controls.Add(descr);
            }

            catch (Exception exc)
            {
                MessageBox.Show(WMISys.GetString("WMISE_Exception", exc.Message, exc.StackTrace));
            }
        }
        /// <summary>
        ///    Required method for Designer support - do not modify
        ///    the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.components = new System.ComponentModel.Container();
            this.NextBtn    = new System.Windows.Forms.Button();
            this.CancelBtn  = new System.Windows.Forms.Button();
            this.FinishBtn  = new System.Windows.Forms.Button();
            this.BackBtn    = new System.Windows.Forms.Button();

            this.ShowInTaskbar = false;
            this.MinimizeBox   = false;
            this.MaximizeBox   = false;

            //@this.TrayHeight = 0;
            //@this.TrayLargeIcon = false;
            //@this.TrayAutoArrange = true;


            TreeLabel          = new Label();
            TreeLabel.Text     = "Available classes:";
            TreeLabel.Location = new Point(15, 105);

            classTree = new WMIClassTreeView(server,
                                             connectAs,
                                             password,
                                             classFilters,
                                             null);

            classTree.Location     = new System.Drawing.Point(15, 128);
            classTree.Size         = new System.Drawing.Size(330, 200);
            classTree.TabIndex     = 0;
            classTree.AfterSelect += (new TreeViewEventHandler(this.AfterNodeSelect));

            QueryLabel          = new Label();
            QueryLabel.Location = new Point(15, 340);
            QueryLabel.Text     = "Event query:";

            QueryText              = new TextBox();
            QueryText.Location     = new Point(15, 363);
            QueryText.Size         = new Size(330, 160);
            QueryText.Multiline    = true;
            QueryText.ReadOnly     = false;
            QueryText.ScrollBars   = ScrollBars.Vertical;
            QueryText.TabIndex     = 1;
            QueryText.TextChanged += new EventHandler(OnQueryTextChanged);

            BackBtn.Location     = new System.Drawing.Point(15, 538);
            BackBtn.Size         = new System.Drawing.Size(75, 23);
            BackBtn.TabIndex     = 2;
            BackBtn.Text         = "&Back";
            BackBtn.Enabled      = true;
            BackBtn.DialogResult = System.Windows.Forms.DialogResult.Retry;

            NextBtn.Location     = new System.Drawing.Point(100, 538);
            NextBtn.Size         = new System.Drawing.Size(75, 23);
            NextBtn.TabIndex     = 2;
            NextBtn.Text         = "&Next";
            NextBtn.Enabled      = false;
            NextBtn.DialogResult = System.Windows.Forms.DialogResult.Yes;

            CancelBtn.Location     = new System.Drawing.Point(185, 538);
            CancelBtn.Size         = new System.Drawing.Size(75, 23);
            CancelBtn.TabIndex     = 3;
            CancelBtn.Text         = "Cancel";
            CancelBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel;

            FinishBtn.Location     = new System.Drawing.Point(270, 538);
            FinishBtn.Size         = new System.Drawing.Size(75, 23);
            FinishBtn.TabIndex     = 4;
            FinishBtn.Text         = "&Finish";
            FinishBtn.DialogResult = System.Windows.Forms.DialogResult.OK;
            FinishBtn.Enabled      = false;


            this.Text = "Select an Event Class";
            this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
            this.ClientSize        = new System.Drawing.Size(360, 579);
            this.Controls.Add(this.FinishBtn);
            this.Controls.Add(this.CancelBtn);
            this.Controls.Add(this.NextBtn);
            this.Controls.Add(this.TreeLabel);
            this.Controls.Add(this.classTree);
            this.Controls.Add(this.QueryLabel);
            this.Controls.Add(this.QueryText);
            this.Controls.Add(this.BackBtn);
        }
Exemple #3
0
        public EventQueryDialog(string serverIn,
                                string user,
                                string pw)
        {
            server    = serverIn;
            connectAs = user;
            password  = pw;


            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            groupBox1.Location = new System.Drawing.Point(8, 20);
            groupBox1.TabStop  = false;
            groupBox1.Text     = WMISys.GetString("WMISE_EventQueryDlg_SelectEventType");
            groupBox1.Size     = new System.Drawing.Size(330, 80);

            InstanceEvents.Location = new System.Drawing.Point(16, 40);
            InstanceEvents.Text     = WMISys.GetString("WMISE_EventQueryDlg_IntrinsicEvents");
            InstanceEvents.Size     = new System.Drawing.Size(288, 23);
            InstanceEvents.TabIndex = 0;
            InstanceEvents.Click   += new EventHandler(OnCheckIntrinsic);
            InstanceEvents.Checked  = true;

            ExtrinsicEvents.Location = new System.Drawing.Point(16, 60);
            ExtrinsicEvents.Text     = WMISys.GetString("WMISE_EventQueryDlg_ExtrinsicEvents");
            ExtrinsicEvents.Size     = new System.Drawing.Size(288, 23);
            ExtrinsicEvents.TabIndex = 1;
            ExtrinsicEvents.TabStop  = true;
            ExtrinsicEvents.Click   += new EventHandler(OnCheckExtrinsic);

            TreeLabel          = new Label();
            TreeLabel.Text     = WMISys.GetString("WMISE_EventQueryDlg_AvailableClasses");
            TreeLabel.Location = new Point(15, 115);

            classTree              = new WMIClassTreeView(server, connectAs, password, classFilters, null);
            classTree.Location     = new System.Drawing.Point(15, 138);
            classTree.Size         = new System.Drawing.Size(330, 200);
            classTree.TabIndex     = 0;
            classTree.AfterSelect += (new TreeViewEventHandler(this.OnNodeSelect));

            EventTypeLabel          = new Label();
            EventTypeLabel.Text     = WMISys.GetString("WMISE_EventQueryDlg_IntrinsicEventComboLabel");
            EventTypeLabel.Location = new Point(15, 358);
            EventTypeLabel.Size     = new Size(330, 18);

            EventTypeSelector                       = new ComboBox();
            EventTypeSelector.Location              = new Point(15, 380);
            EventTypeSelector.Size                  = new Size(330, 20);
            EventTypeSelector.SelectedIndexChanged += (new EventHandler(OnIntrinsicEventTypeChanged));

            //sort instance operations alphabetically
            ArrayList operationList = new ArrayList(strIntrinsicEvents);

            operationList.Sort();
            foreach (string eventName in operationList)
            {
                EventTypeSelector.Items.Add(eventName);
            }

            EventTypeSelector.SelectedIndex = 0;

            pollingIntervalLbl.Location = new Point(15, 415);
            pollingIntervalLbl.Text     = WMISys.GetString("WMISE_EventQueryDlg_PollingIntervalLabel");
            pollingIntervalLbl.Size     = new Size(150, 20);

            pollingIntervalBox          = new TextBox();
            pollingIntervalBox.Text     = DefaultPollingInterval;
            pollingIntervalBox.Location = new Point(15, 435);
            pollingIntervalBox.Size     = new Size(60, 20);
            pollingIntervalBox.Leave   += new EventHandler(OnPollingChanged);

            secondsLbl.Text     = WMISys.GetString("WMISE_Seconds");
            secondsLbl.Location = new Point(90, 435);

            HelpBtn.Location = new System.Drawing.Point(15, 470);
            HelpBtn.Size     = new System.Drawing.Size(75, 23);
            HelpBtn.TabIndex = 2;
            HelpBtn.Text     = WMISys.GetString("WMISE_Help");
            HelpBtn.Enabled  = true;

            OKBtn.Location     = new System.Drawing.Point(100, 470);
            OKBtn.Size         = new System.Drawing.Size(75, 23);
            OKBtn.TabIndex     = 2;
            OKBtn.Text         = WMISys.GetString("WMISE_SubscribeBtn");
            OKBtn.Enabled      = false;
            OKBtn.DialogResult = System.Windows.Forms.DialogResult.OK;

            CancelBtn.Location     = new System.Drawing.Point(185, 470);
            CancelBtn.Size         = new System.Drawing.Size(75, 23);
            CancelBtn.TabIndex     = 3;
            CancelBtn.Text         = WMISys.GetString("WMISE_Cancel");
            CancelBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel;

            AdvancedBtn.Location = new System.Drawing.Point(270, 470);
            AdvancedBtn.Size     = new System.Drawing.Size(75, 23);
            AdvancedBtn.TabIndex = 4;
            AdvancedBtn.Text     = WMISys.GetString("WMISE_AdvancedBtn");
            AdvancedBtn.Click   += new EventHandler(OnAdvanced);
            AdvancedBtn.Enabled  = false;

            this.Text          = WMISys.GetString("WMISE_EventQueryDlg_Title");
            this.BorderStyle   = FormBorderStyle.FixedDialog;
            this.ShowInTaskbar = false;
            this.MinimizeBox   = false;
            this.MaximizeBox   = false;

            this.Controls.Add(TreeLabel);
            this.Controls.Add(EventTypeLabel);
            this.Controls.Add(EventTypeSelector);
            this.Controls.Add(classTree);
            this.Controls.Add(pollingIntervalLbl);
            this.Controls.Add(pollingIntervalBox);
            this.Controls.Add(secondsLbl);

            this.Controls.Add(ExtrinsicEvents);
            this.Controls.Add(InstanceEvents);
            this.Controls.Add(groupBox1);
            this.Controls.Add(OKBtn);
            this.Controls.Add(HelpBtn);
            this.Controls.Add(CancelBtn);
            this.Controls.Add(AdvancedBtn);
        }