/// <summary> /// The child has data available - get it. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void Child_DataAvailable(object sender, EventArgs e) { WpfControlLibrary.UserControlHome child = sender as WpfControlLibrary.UserControlHome; if (child != null) { if (int.Parse(child.args.Split(' ')[1]) < 3) { MessageBox.Show("Invalid Configuration: ESP number must be greater then 2"); } else { PopupNotifier popup = new PopupNotifier(); popup.TitleText = "ESP Configuration"; popup.ContentText = "ESP Configuration confirmed!"; popup.AnimationDuration = 5; popup.BodyColor = System.Drawing.Color.FromArgb(51, 51, 76); popup.ContentColor = System.Drawing.Color.White; popup.BorderColor = System.Drawing.Color.FromArgb(199, 21, 133); popup.TitleColor = System.Drawing.Color.FromArgb(199, 21, 133); popup.Popup(); config = child.args; file = child.filename; old = 0; } } }
private void btnSettings_Click_1(object sender, EventArgs e) { // Create the WPF UserControl. if (currentUC != "Home") { if (currentUC == "Console") { MessageBoxButtons buttons = MessageBoxButtons.YesNo; DialogResult result; // Displays the MessageBox. result = MessageBox.Show("Do You want to interrupt the Server execution?", "Exit from Server Execution", buttons); if (result == System.Windows.Forms.DialogResult.Yes) { ActivateButton(sender, RGBColors.color2); // Closes the parent form. lblFormTitle.Text = "ESP Settings"; WpfControlLibrary.UserControlHome uc = new WpfControlLibrary.UserControlHome(); // Assign the WPF UserControl to the ElementHost control's // Child property. uc.DataAvailable += new EventHandler(Child_DataAvailable); elementHostHome.Child = uc; currentUC = "Home"; } } else { ActivateButton(sender, RGBColors.color2); lblFormTitle.Text = "ESP Settings"; WpfControlLibrary.UserControlHome uc = new WpfControlLibrary.UserControlHome(); // Assign the WPF UserControl to the ElementHost control's // Child property. uc.DataAvailable += new EventHandler(Child_DataAvailable); elementHostHome.Child = uc; currentUC = "Home"; } } }
//Constructor public FormMainMenu() { InitializeComponent(); leftBorderBtn = new Panel(); leftBorderBtn.Size = new Size(7, 60); panelMenu.Controls.Add(leftBorderBtn); ActivateButton(btnSettings, RGBColors.color2); WpfControlLibrary.UserControlHome uc = new WpfControlLibrary.UserControlHome(); // Assign the WPF UserControl to the ElementHost control's // Child property. uc.DataAvailable += new EventHandler(Child_DataAvailable); elementHostHome.Child = uc; //Form this.Text = string.Empty; this.ControlBox = false; this.DoubleBuffered = true; this.MaximizedBounds = Screen.FromHandle(this.Handle).WorkingArea; }