/// <summary> /// Raises the <see cref="Previous"/> event. /// </summary> /// <param name="e">An instance of <see cref="WizardCancelEventArgs"/> containing event data.</param> protected virtual void OnPrevious(WizardCancelEventArgs e) { if (this.Previous != null) { this.Previous(this, e); } }
/// <summary> /// Raises the <see cref="Next"/> event. /// </summary> /// <param name="e">An instance of <see cref="WizardCancelEventArgs"/> containing event data.</param> protected virtual void OnNext(WizardCancelEventArgs e) { if (this.Next != null) { this.Next(this, e); } }
protected virtual void OnPrevious(WizardCancelEventArgs e) { if (this.Previous == null) { return; } this.Previous((object)this, e); }
protected virtual void OnNext(WizardCancelEventArgs e) { if (this.Next == null) { return; } this.Next((object)this, e); }
/// <summary> /// Selects previous wizard page. /// </summary> public void SelectPreviousPage() { WizardCancelEventArgs e = new WizardCancelEventArgs(); this.OnPrevious(e); if (e.Cancel) { return; } int selectedPageIndex = this.Pages.IndexOf(this.SelectedPage); if (selectedPageIndex > 0) { this.SelectedPage = this.Pages[--selectedPageIndex]; } }
/// <summary> /// Selects next wizard page. /// </summary> public void SelectNextPage() { WizardCancelEventArgs e = new WizardCancelEventArgs(); this.OnNext(e); if (e.Cancel) { return; } int selectedPageIndex = this.Pages.IndexOf(this.SelectedPage); if (selectedPageIndex < this.Pages.Count - 1) { this.SelectedPage = this.Pages[++selectedPageIndex]; } }
public void SelectPreviousPage() { WizardCancelEventArgs e = new WizardCancelEventArgs(); this.OnPrevious(e); if (e.Cancel) { return; } int num1 = this.Pages.IndexOf(this.SelectedPage); if (num1 <= 0) { return; } int num2; this.SelectedPage = this.Pages[num2 = num1 - 1]; }
public void SelectNextPage() { WizardCancelEventArgs e = new WizardCancelEventArgs(); this.OnNext(e); if (e.Cancel) { return; } int num1 = this.Pages.IndexOf(this.SelectedPage); if (num1 >= this.Pages.Count - 1) { return; } int num2; this.SelectedPage = this.Pages[num2 = num1 + 1]; }
//下一步時 private void radWizard1_Next(object sender, Telerik.WinControls.UI.WizardCancelEventArgs e) { //如果列表是空的 且烈表中有打勾 if (NewTargetName.Text != "" && NewTargetIP.Text != "") { //對DB座新增動作 String strSQL = "INSERT INTO [LinuxTarget](TargetName,TargetIP) VALUES ('" + NewTargetName.Text + "','" + NewTargetIP.Text + "')"; System.Data.OleDb.OleDbConnection oleConn = new System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OleDb.4.0;Data Source=FreeSpaceEyesDB.mdb"); //// 開啟資料庫連接。 oleConn.Open(); //// OleDbCommand (String, OleDbConnection) : 使用查詢的文字和 OleDbConnection,初始化 OleDbCommand 類別的新執行個體。 System.Data.OleDb.OleDbCommand oleCmd = new System.Data.OleDb.OleDbCommand(strSQL, oleConn); oleCmd.ExecuteNonQuery(); //// 關閉資料庫連接。 oleConn.Close(); } else { MessageBox.Show("欄位不得為空"); } }
private void wizardElement_Previous(object sender, WizardCancelEventArgs e) { this.OnPrevious(e); }
private void wizardElement_Next(object sender, WizardCancelEventArgs e) { this.OnNext(e); }
//下一步時 private void radWizard1_Next(object sender, Telerik.WinControls.UI.WizardCancelEventArgs e) { //如果在第二夜,則檢察目標機器的硬碟 if (radWizard1.SelectedPage == this.radWizard1.Pages[0]) { //清除列表 TargetDeviceIDView.Items.Clear(); try { //這邊進行wmi查詢目標硬碟代號 System.Management.ConnectionOptions Conn = new ConnectionOptions(); //設定用於WMI連接操作的用戶名 string user = NewTargetDomainName.Text + "\\" + NewTargetUsername.Text; Conn.Username = user; //設定用戶的密碼 Conn.Password = NewTargetPassword.Text; //設定用於執行WMI操作的範圍 System.Management.ManagementScope Ms = new ManagementScope("\\\\" + NewTargetIP.Text + "\\root\\cimv2", Conn); Ms.Connect(); ObjectQuery Query = new ObjectQuery("select DeviceID from Win32_LogicalDisk where DriveType=3"); //WQL語句,設定的WMI查詢內容和WMI的操作範圍,檢索WMI對象集合 ManagementObjectSearcher Searcher = new ManagementObjectSearcher(Ms, Query); //異步調用WMI查詢 ManagementObjectCollection ReturnCollection = Searcher.Get(); foreach (ManagementObject Return in ReturnCollection) { TargetDeviceIDView.Items.Add(Return["DeviceID"]); } } catch (Exception) { //發生問題 警告並回到第一夜 radWizard1.SelectedPage = this.radWizard1.WelcomePage; } } //如果在第三夜 則寫入資料庫 if (radWizard1.SelectedPage == this.radWizard1.Pages[1]) { //如果列表是空的 且烈表中有打勾 if (TargetDeviceIDView.Items.Count != 0 && TargetDeviceIDView.CheckedItems != null) { //取得勾選的deviceID foreach (ListViewDataItem DeviceID in TargetDeviceIDView.CheckedItems) { //對DB座新增動作 String strSQL = "INSERT INTO [WindowsTarget](TargetName,TargetIP,TargetDomain,TargetUser,TargetPassword,TargetDeviceID) VALUES ('" + NewTargetName.Text + "','" + NewTargetIP.Text + "','" + NewTargetDomainName.Text + "','" + NewTargetUsername.Text + "','" + NewTargetPassword.Text + "','" + DeviceID.Text + "')"; System.Data.OleDb.OleDbConnection oleConn = new System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OleDb.4.0;Data Source=FreeSpaceEyesDB.mdb"); //// 開啟資料庫連接。 oleConn.Open(); //// OleDbCommand (String, OleDbConnection) : 使用查詢的文字和 OleDbConnection,初始化 OleDbCommand 類別的新執行個體。 System.Data.OleDb.OleDbCommand oleCmd = new System.Data.OleDb.OleDbCommand(strSQL, oleConn); oleCmd.ExecuteNonQuery(); //// 關閉資料庫連接。 oleConn.Close(); } } else { MessageBox.Show("無法取得目標DeviceID,請回到上一步"); } } }