Here are the examples of the csharp api System.Windows.Forms.Control.Hide() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
1008 Examples
19
Source : PreviewForm.cs
with MIT License
from awaescher
with MIT License
from awaescher
public void InvalidatePreview()
{
if (IsDisposed)
return;
if (!AllowUpdates)
return;
if (Preview == null)
{
Hide();
}
else
{
var preferredSize = Preview.PreferredSize;
if (preferredSize != Size)
Size = preferredSize;
}
Opacity = PreviewOpacityController?.Opacity ?? 0.8;
TransparencyKey = PreviewOpacityController?.TransparencyKey ?? Color.Empty;
Invalidate();
}
19
Source : AyWinformHost.cs
with MIT License
from ay2015
with MIT License
from ay2015
private void _placementTarget_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
{
var d = (bool)e.NewValue;
if (d)
{
_form.Show();
}
else
{
_form.Hide();
}
}
19
Source : CarRentalHome.cs
with MIT License
from aykutsahin98
with MIT License
from aykutsahin98
private void buttonCar_Click(object sender, EventArgs e)
{
CarOperations car = new CarOperations();
car.Show();
this.Hide();
}
19
Source : CarRentalHome.cs
with MIT License
from aykutsahin98
with MIT License
from aykutsahin98
private void buttonRent_Click(object sender, EventArgs e)
{
RentACarOperations rent = new RentACarOperations();
rent.Show();
this.Hide();
}
19
Source : CarOperations.cs
with MIT License
from aykutsahin98
with MIT License
from aykutsahin98
private void homeScreenMenuItem_Click(object sender, EventArgs e)
{
CarRentalHome home = new CarRentalHome();
home.Show();
this.Hide();
}
19
Source : ItemEditForm.cs
with GNU General Public License v3.0
from az64
with GNU General Public License v3.0
from az64
private void fItemEdit_FormClosing(object sender, FormClosingEventArgs e)
{
if (e.CloseReason == CloseReason.UserClosing)
{
e.Cancel = true;
Hide();
}
}
19
Source : JunkLocationEditForm.cs
with GNU General Public License v3.0
from az64
with GNU General Public License v3.0
from az64
private void JunkLocationEditForm_FormClosing(object sender, FormClosingEventArgs e)
{
if (e.CloseReason == CloseReason.UserClosing)
{
e.Cancel = true;
Hide();
}
}
19
Source : LogicEditorForm.cs
with GNU General Public License v3.0
from az64
with GNU General Public License v3.0
from az64
private void fLogicEdit_FormClosing(object sender, FormClosingEventArgs e)
{
if (e.CloseReason == CloseReason.UserClosing)
{
e.Cancel = true;
Hide();
};
}
19
Source : ManualForm.cs
with GNU General Public License v3.0
from az64
with GNU General Public License v3.0
from az64
private void fManual_FormClosing(object sender, FormClosingEventArgs e)
{
if (e.CloseReason == CloseReason.UserClosing)
{
e.Cancel = true;
Hide();
};
}
19
Source : StartingItemEditForm.cs
with GNU General Public License v3.0
from az64
with GNU General Public License v3.0
from az64
private void StartingItemEditForm_FormClosing(object sender, FormClosingEventArgs e)
{
if (e.CloseReason == CloseReason.UserClosing)
{
e.Cancel = true;
Hide();
}
}
19
Source : Login.cs
with MIT License
from b9q
with MIT License
from b9q
private void btnLogin_Click(object sender, EventArgs e)
{
dynamic result = Networking.Login(flex_username_box.Text, flex_preplacedword_box.Text);
if (result != null)
{
if ((string)result.status == "failed")
{
string issue = (string)result.detail;
string extra_information = (string)result.extra;
switch (issue)
{
case "connection error":
default:
unknown_error();
return;
case "no account":
case "wrong preplacedword":
MessageBox.Show("Incorrect username or preplacedword.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
flex_preplacedword_box.ResetText();
return;
case "sub invalid":
MessageBox.Show("Your subscription is invalid or expired.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
case "hwid mismatch":
MessageBox.Show("Your PC is not authorized.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
case "banned":
MessageBox.Show("Your account has been banned.\nReason: " + extra_information, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
security_functions.delete_self();
Environment.Exit(1);
return;
case "server offline":
MessageBox.Show($"The server is currently disabled.\nReason: {(string)result.reason}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
Environment.Exit(5);
break;
}
}
else if ((string)result.status == "successful" && (string)result.username == flex_username_box.Text && (int)result.time_left > 0)
{
if (c_utility.get_epoch_time() - (double) result.time > 30)
{
Environment.Exit(0); //prevent replay attacks
return;
}
if (flex_remember_me.Checked)
{
Properties.Settings.Default.username = flex_username_box.Text;
Properties.Settings.Default.preplacedword = flex_preplacedword_box.Text;
Properties.Settings.Default.Save();
}
RegistryKey key = Registry.CurrentUser.OpenSubKey("Software", true);
key.CreateSubKey("VER$ACE");
key = key.OpenSubKey("VER$ACE", true);
key.SetValue("username", aes.encrypt_string((string)result.username));
MessageBox.Show($"Welcome back, {(string)result.username}!\n This build was created on [BUILD]", "VER$ACE", MessageBoxButtons.OK, MessageBoxIcon.Information);
saved_info.username = flex_username_box.Text;
saved_info.preplacedword = flex_preplacedword_box.Text;
keep_open = true;
Forms.Main form = new Forms.Main(result);
form.Show();
Hide();
}
else {
unknown_error();
}
}
else {
unknown_error();
}
}
19
Source : Main.cs
with MIT License
from b9q
with MIT License
from b9q
private void btnInject_Click(object sender, EventArgs e)
{
//moved in here so that HTTPDebugger stuff doesn't show until we hit inject
dynamic dll_related_info = Networking.get_dll(Authentication.saved_info.username, Authentication.saved_info.preplacedword);
if ((string)dll_related_info.status == "failed")
{
Environment.Exit(0);
return;
}
if (c_utility.get_epoch_time() - (double) dll_related_info.time > 30)
{
Environment.Exit(0); //preventing replay attacks (i think thats what its called)
return;
}
download_link = Reverse(Encoding.UTF8.GetString(Convert.FromBase64String(Reverse((string)dll_related_info.download))));
var key = (string)dll_related_info.key;
dec_key = key.Substring(12, key.Length - 24);
using (WebClient web = new WebClient())
{
web.Headers.Add("user-agent", "VER$ACE");
ServicePointManager.Expect100Continue = true;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
cheat_file = web.DownloadData(download_link);
}
Hide();
injection_helper.start_injection_thread(cheat_file, dec_key);
MessageBox.Show("Injection started.\n\nPlease start csgo!", "VER$ACE", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
19
Source : Main.cs
with MIT License
from bandaranayake
with MIT License
from bandaranayake
private void btnDraw_Click(object sender, EventArgs e)
{
if (_original == null)
{
MessageBox.Show("No image selected. Click 'Browse' to select an image.", Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else
{
Hide();
Thread.Sleep(500);
Bitmap image = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
using (Graphics g = Graphics.FromImage(image))
{
g.CopyFromScreen(Screen.PrimaryScreen.Bounds.X, Screen.PrimaryScreen.Bounds.Y, 0, 0, image.Size, CopyPixelOperation.SourceCopy);
g.DrawRectangle(Pens.Red, 1, 1, image.Width - 3, image.Height - 3);
}
ScreenOverlay overlay = new ScreenOverlay(image);
Show();
if (overlay.ShowDialog() == DialogResult.OK)
{
WindowState = FormWindowState.Minimized;
image.Dispose();
CvInvoke.Resize(_img, _img, new Size(_img.Cols, _img.Rows));
CvInvoke.BitwiseNot(_img, _img);
Thread.Sleep(2000);
_lastPoint = new Point(-1, -1);
_pid = GetActiveProcess();
Draw(_img, overlay.Pos.X, overlay.Pos.Y);
WindowState = FormWindowState.Normal;
}
}
}
19
Source : Launcher.cs
with GNU General Public License v3.0
from belowaverage-org
with GNU General Public License v3.0
from belowaverage-org
public void FadeOut()
{
Hide();
}
19
Source : Stock.cs
with MIT License
from bilalmehrban
with MIT License
from bilalmehrban
private void dgvstock_RowHeaderMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
{
Manage_Products manage = new Manage_Products();
manage.Show();
this.Hide();
}
19
Source : Login.cs
with MIT License
from bilalmehrban
with MIT License
from bilalmehrban
private void button1_Click(object sender, EventArgs e)
{
//Checking if text boxes are empty or null
if (Validation())
{
//Gettting Data FRom UI
u.user_name = txtusername.Text.Trim();
u.preplacedword = txtpreplacedword.Text.Trim();
u.user_type = txtusertype.Text.Trim();
//Checking the login credentials
bool check = dal.login(u);
if (check == true)
{
//Login Successfull
loggedIn = u.user_name;
//Need to open Respective Forms based on User Type
switch (u.user_type)
{
case "Admin":
{
//Display Admin Dashboard
Main admin = new Main();
admin.Show();
this.Hide();
}
break;
case "Sales Man":
{
//Display SalesMan Dashboard
mainform obj = new mainform();
obj.Show();
this.Hide();
}
break;
default:
{
//Display an error message
MessageBox.Show("Invalid user type");
}
break;
}
}
else
{
//login Failed
MessageBox.Show("Incorrect Credentials");
}
}
}
19
Source : ShellList.cs
with MIT License
from BluePointLilac
with MIT License
from BluePointLilac
private void ShowSelectDialog()
{
SelectDialog dlg = null;
switch(Scene)
{
case Scenes.CustomExtension:
dlg = new FileExtensionDialog
{
Selected = CurrentExtension?.Substring(1)
};
break;
case Scenes.PerceivedType:
dlg = new SelectDialog
{
Items = PerceivedTypeNames,
replacedle = AppString.Dialog.SelectPerceivedType,
Selected = GetPerceivedTypeName(CurrentPerceivedType)
};
break;
case Scenes.DirectoryType:
dlg = new SelectDialog
{
Items = DirectoryTypeNames,
replacedle = AppString.Dialog.SelectDirectoryType,
Selected = GetDirectoryTypeName(CurrentDirectoryType)
};
break;
case Scenes.CustomExtensionPerceivedType:
dlg = new SelectDialog
{
Items = PerceivedTypeNames,
replacedle = AppString.Dialog.SelectPerceivedType,
Selected = GetPerceivedTypeName(CurrentExtensionPerceivedType)
};
break;
case Scenes.DragDrop:
dlg = new SelectDialog
{
Items = DropEffectNames,
replacedle = AppString.Dialog.SelectDropEffect,
Selected = GetDropEffectName()
};
break;
case Scenes.Menureplacedysis:
dlg = new SelectDialog
{
Items = new[] { AppString.SideBar.File, AppString.SideBar.Directory },
replacedle = AppString.Dialog.SelectObjectType,
};
break;
case Scenes.CustomRegPath:
if(AppMessageBox.Show(AppString.Message.SelectRegPath,
MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes) return;
Form frm = this.FindForm();
frm.Hide();
using(Process process = Process.Start("regedit.exe", "-m"))
{
process.WaitForExit();
}
string path = Registry.GetValue(LASTKEYPATH, "LastKey", "").ToString();
int index = path.IndexOf('\\');
if(index == -1) return;
path = path.Substring(index + 1);
CurrentCustomRegPath = path;
this.RefreshList();
frm.Show();
frm.Activate();
break;
}
switch(Scene)
{
case Scenes.CustomExtension:
case Scenes.PerceivedType:
case Scenes.DirectoryType:
case Scenes.Menureplacedysis:
case Scenes.DragDrop:
case Scenes.CustomExtensionPerceivedType:
if(dlg.ShowDialog() != DialogResult.OK) return;
break;
}
switch(Scene)
{
case Scenes.CustomExtension:
CurrentExtension = dlg.Selected;
this.RefreshList();
break;
case Scenes.PerceivedType:
CurrentPerceivedType = PerceivedTypes[dlg.SelectedIndex];
this.RefreshList();
break;
case Scenes.DirectoryType:
CurrentDirectoryType = DirectoryTypes[dlg.SelectedIndex];
this.RefreshList();
break;
case Scenes.CustomExtensionPerceivedType:
string selected = PerceivedTypes[dlg.SelectedIndex];
CurrentExtensionPerceivedType = selected;
this.Text = AppString.Other.SetPerceivedType.Replace("%s", CurrentExtension) + " " + GetPerceivedTypeName(selected);
break;
case Scenes.DragDrop:
switch(dlg.SelectedIndex)
{
case 0: DefaultDropEffect = DropEffect.Default; break;
case 1: DefaultDropEffect = DropEffect.Copy; break;
case 2: DefaultDropEffect = DropEffect.Move; break;
case 3: DefaultDropEffect = DropEffect.CreateLink; break;
}
this.Text = AppString.Other.SetDefaultDropEffect + " " + GetDropEffectName();
break;
case Scenes.Menureplacedysis:
if(dlg.SelectedIndex == 0)
{
using(var dlg1 = new System.Windows.Forms.OpenFileDialog())
{
dlg1.DereferenceLinks = false;
if(dlg1.ShowDialog() != DialogResult.OK) return;
CurrentFileObjectPath = dlg1.FileName;
}
}
else
{
using(var dlg2 = new FolderBrowserDialog())
{
if(dlg2.ShowDialog() != DialogResult.OK) return;
CurrentFileObjectPath = dlg2.SelectedPath;
}
}
this.RefreshList();
break;
}
}
19
Source : FormEditPicture.cs
with MIT License
from BluePointLilac
with MIT License
from BluePointLilac
private void SendPicture(object sender, EventArgs e) {
var p = (TilePic)sender;
if (p.BorderStyle == BorderStyle.FixedSingle) {
var frm = new FormEditConfig();
if (myBitmap != null) {
double num = (double)myBitmap.Width / picEdited.Width;
int pX = Convert.ToInt32(num * (p.Left - picEdited.Left));
int pY = Convert.ToInt32(num * (p.Top - picEdited.Top));
int num2 = Convert.ToInt32(num * (p.Width - 1));
Bitmap part = PartImage.GetPart(myBitmap, pX, pY, num2, num2);
frm.picEditedView.Image = part;
}
this.Hide();
frm.FormClosed += (a, b) => this.Show();
frm.ShowDialog();
}
}
19
Source : MainForm.cs
with GNU General Public License v3.0
from boonkerz
with GNU General Public License v3.0
from boonkerz
private void MainForm_Resize(object sender, EventArgs e)
{
if (FormWindowState.Minimized == this.WindowState)
{
ShowIcon = false;
notifyIcon1.Visible = true;
notifyIcon1.ShowBalloonTip(1000);
this.Hide();
}
}
19
Source : SearchHelpForm.cs
with MIT License
from botman99
with MIT License
from botman99
private void SearchHelpForm_Closing(object sender, FormClosingEventArgs e)
{
e.Cancel = true; // don't let the 'X' button close the form (the SearchForm will close this form)
Hide();
}
19
Source : SearchHelpForm.cs
with MIT License
from botman99
with MIT License
from botman99
private void SearchHelpOkButton_Click(object sender, EventArgs e)
{
Hide();
}
19
Source : MainForm.cs
with MIT License
from bp2008
with MIT License
from bp2008
private void panel_Graphs_Click(object sender, EventArgs e)
{
if (panel_Graphs.Parent == splitContainer1.Panel2)
{
panelForm.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
panelForm.Controls.Add(panel_Graphs);
panel_Graphs.Dock = DockStyle.Fill;
panelForm.Show();
panelForm.SetBounds(this.Left, this.Top, this.Width, this.Height);
this.Hide();
}
else
{
splitContainer1.Panel2.Controls.Add(panel_Graphs);
panel_Graphs.Dock = DockStyle.Fill;
this.Show();
panelForm.Hide();
}
}
19
Source : Options.cs
with GNU General Public License v3.0
from brhinescot
with GNU General Public License v3.0
from brhinescot
private void HandlePluginSelectionChanged(object sender, EventArgs e)
{
if (configForm != null)
{
configForm.Hide();
pluginConfigHostPanel.Controls.Remove(configForm);
configForm = null;
}
IConfigurablePlugin plugin = pluginsComboBox.SelectedItem as IConfigurablePlugin;
if (plugin?.ConfigurationForm != null)
{
configForm = plugin.ConfigurationForm;
configForm.PerformAutoScale();
if (plugin.HostInOptions)
ShowHostedConfiguration();
else
ShowDialogConfiguration();
}
}
19
Source : Form1.cs
with GNU General Public License v3.0
from brunopaiva15
with GNU General Public License v3.0
from brunopaiva15
private void button1_Click(object sender, EventArgs e)
{
Wizard wizard = new Wizard();
this.Hide();
wizard.ShowDialog();
}
19
Source : Wizard.cs
with GNU General Public License v3.0
from brunopaiva15
with GNU General Public License v3.0
from brunopaiva15
private void button1_Click(object sender, EventArgs e)
{
Form1 form1 = new Form1();
this.Hide();
form1.ShowDialog();
}
19
Source : frmCpl.cs
with Mozilla Public License 2.0
from cathoderaydude
with Mozilla Public License 2.0
from cathoderaydude
private void FrmCpl_SizeChanged(object sender, EventArgs e)
{
if (this.WindowState == FormWindowState.Minimized)
{
this.Hide();
}
}
19
Source : FrmMain.cs
with MIT License
from cdmxz
with MIT License
from cdmxz
private void HideWin(object sender, EventArgs e)
{
this.Hide();
this.ShowInTaskbar = false;
}
19
Source : Form1.cs
with MIT License
from cdmxz
with MIT License
from cdmxz
private void Form1_Resize(object sender, EventArgs e)
{
// 关于选项
MenuItem about = new MenuItem("关于");
about.Click += new EventHandler(new_about);
// 退出菜单项
MenuItem exit = new MenuItem("退出");
exit.Click += new EventHandler(exit_Click);
// 关联托盘控件
MenuItem[] childen = new MenuItem[] { about, exit };
notifyIcon1.ContextMenu = new ContextMenu(childen);
// 判断当前窗口是否最小化
if (this.WindowState == FormWindowState.Minimized)
{
this.Hide(); // 隐藏当前窗口
notifyIcon1.Visible = true; // 任务栏显示图标
//托盘图标显示的内容
notifyIcon1.Text = "鼠连点,双击此图标显示窗口";
//气泡显示的内容和时间(从 Windows Vista 开始,否决此参数。 现在通知显示时间是基于系统辅助功能设置。)
notifyIcon1.ShowBalloonTip(1, "鼠连点", "鼠连点正在后台运行...", ToolTipIcon.None);
}
else
notifyIcon1.Visible = false;
}
19
Source : RenameBox.cs
with GNU General Public License v3.0
from Ch3shireDev
with GNU General Public License v3.0
from Ch3shireDev
private void KillTextBox()
{
Parent?.Controls.Remove(this);
Parent?.Select();
Hide();
}
19
Source : BandObject.cs
with MIT License
from ChDC
with MIT License
from ChDC
public int ShowDW(bool bShow)
{
if (bShow)
Show();
else
Hide();
return S_OK;
}
19
Source : SettingsHost.cs
with Apache License 2.0
from Chem4Word
with Apache License 2.0
from Chem4Word
private void OnWpfButtonClick(object sender, EventArgs e)
{
WpfEventArgs args = (WpfEventArgs)e;
switch (args.Button.ToLower())
{
case "ok":
DialogResult = DialogResult.OK;
SettingsControl sc = elementHost1.Child as SettingsControl;
if (sc != null)
{
SystemOptions = sc.SystemOptions;
SaveChanges();
sc.Dirty = false;
Hide();
}
break;
case "cancel":
DialogResult = DialogResult.Cancel;
_closedInCode = true;
Hide();
break;
}
}
19
Source : ChemDoodleWeb.cs
with Apache License 2.0
from Chem4Word
with Apache License 2.0
from Chem4Word
private void btnOk_Click(object sender, EventArgs e)
{
string module = $"{_product}.{_clreplaced}.{MethodBase.GetCurrentMethod().Name}()";
try
{
object obj = null;
obj = ExecuteJavaScript("GetFormula");
if (obj != null)
{
After_Formula = obj.ToString();
}
obj = ExecuteJavaScript("GetJSON");
if (obj != null)
{
string mol = obj.ToString();
if (!string.IsNullOrEmpty(mol))
{
JToken molJson = JObject.Parse(obj.ToString());
After_JSON = molJson.ToString();
DialogResult = DialogResult.OK;
Hide();
}
else
{
DialogResult = DialogResult.Cancel;
Hide();
}
}
else
{
DialogResult = DialogResult.Cancel;
Hide();
}
}
catch (Exception ex)
{
new ReportError(Telemetry, TopLeft, module, ex).ShowDialog();
}
}
19
Source : Settings.cs
with Apache License 2.0
from Chem4Word
with Apache License 2.0
from Chem4Word
private void btnOk_Click(object sender, EventArgs e)
{
string module = $"{_product}.{_clreplaced}.{MethodBase.GetCurrentMethod().Name}()";
Telemetry.Write(module, "Action", "Triggered");
try
{
SaveChanges();
_dirty = false;
DialogResult = DialogResult.OK;
Hide();
}
catch (Exception ex)
{
new ReportError(Telemetry, TopLeft, module, ex).ShowDialog();
}
}
19
Source : EditorHost.cs
with Apache License 2.0
from Chem4Word
with Apache License 2.0
from Chem4Word
private void OnWpfOkButtonClick(object sender, EventArgs e)
{
WpfEventArgs args = (WpfEventArgs)e;
if (args.Button.Equals("OK"))
{
Result = DialogResult.OK;
OutputValue = args.OutputValue;
Hide();
}
}
19
Source : EditorHost.cs
with Apache License 2.0
from Chem4Word
with Apache License 2.0
from Chem4Word
private void OnWpfButtonClick(object sender, EventArgs e)
{
string module = $"{_product}.{_clreplaced}.{MethodBase.GetCurrentMethod().Name}()";
WpfEventArgs args = (WpfEventArgs)e;
if (args.Button.ToUpper().Equals("OK"))
{
DialogResult = DialogResult.OK;
CMLConverter cc = new CMLConverter();
JSONConverter jc = new JSONConverter();
Model.Model model = jc.Import(args.OutputValue);
OutputValue = cc.Export(model);
}
if (args.Button.ToUpper().Equals("CANCEL"))
{
DialogResult = DialogResult.Cancel;
OutputValue = "";
}
WpfChemDoodle editor = elementHost1.Child as WpfChemDoodle;
if (editor != null)
{
editor.OnButtonClick -= OnWpfButtonClick;
editor = null;
}
Hide();
}
19
Source : SearchOpsin.cs
with Apache License 2.0
from Chem4Word
with Apache License 2.0
from Chem4Word
private void ImportButton_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.OK;
Hide();
}
19
Source : Settings.cs
with Apache License 2.0
from Chem4Word
with Apache License 2.0
from Chem4Word
private void btnOk_Click(object sender, EventArgs e)
{
string module = $"{_product}.{_clreplaced}.{MethodBase.GetCurrentMethod().Name}()";
try
{
SaveChanges();
_dirty = false;
DialogResult = DialogResult.OK;
Hide();
}
catch (Exception ex)
{
new ReportError(Telemetry, TopLeft, module, ex).ShowDialog();
}
}
19
Source : SearchPubChem.cs
with Apache License 2.0
from Chem4Word
with Apache License 2.0
from Chem4Word
private void ImportButton_Click(object sender, EventArgs e)
{
string module = $"{_product}.{_clreplaced}.{MethodBase.GetCurrentMethod().Name}()";
try
{
DialogResult = DialogResult.OK;
Hide();
}
catch (Exception ex)
{
new ReportError(Telemetry, TopLeft, module, ex).ShowDialog();
}
}
19
Source : SearchPubChem.cs
with Apache License 2.0
from Chem4Word
with Apache License 2.0
from Chem4Word
private void Results_DoubleClick(object sender, EventArgs e)
{
string module = $"{_product}.{_clreplaced}.{MethodBase.GetCurrentMethod().Name}()";
try
{
Debug.WriteLine("Results_DoubleClick");
DialogResult = DialogResult.OK;
Hide();
}
catch (Exception ex)
{
new ReportError(Telemetry, TopLeft, module, ex).ShowDialog();
}
}
19
Source : Chem4WordSettingsHost.cs
with Apache License 2.0
from Chem4Word
with Apache License 2.0
from Chem4Word
private void OnWpfButtonClick(object sender, EventArgs e)
{
WpfEventArgs args = (WpfEventArgs)e;
switch (args.Button.ToLower())
{
case "ok":
DialogResult = DialogResult.OK;
if (elementHost1.Child is SettingsControl sc)
{
SystemOptions = sc.SystemOptions;
SystemOptions.Save();
sc.Dirty = false;
Hide();
}
break;
case "cancel":
DialogResult = DialogResult.Cancel;
_closedInCode = true;
Hide();
break;
}
}
19
Source : EditLabelsHost.cs
with Apache License 2.0
from Chem4Word
with Apache License 2.0
from Chem4Word
private void Save_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.OK;
_closedInCode = true;
if (elementHost1.Child is LabelsEditor editor)
{
CMLConverter cc = new CMLConverter();
DialogResult = DialogResult.OK;
Cml = cc.Export(editor.EditedModel);
Hide();
}
}
19
Source : EditLabelsHost.cs
with Apache License 2.0
from Chem4Word
with Apache License 2.0
from Chem4Word
private void Cancel_Click(object sender, EventArgs e)
{
Hide();
}
19
Source : EditorHost.cs
with Apache License 2.0
from Chem4Word
with Apache License 2.0
from Chem4Word
private void Save_Click(object sender, EventArgs e)
{
CMLConverter cc = new CMLConverter();
DialogResult = DialogResult.Cancel;
if (elementHost1.Child is CmlEditor editor
&& editor.IsDirty)
{
DialogResult = DialogResult.OK;
OutputValue = cc.Export(editor.EditedModel);
}
Hide();
}
19
Source : EditorHost.cs
with Apache License 2.0
from Chem4Word
with Apache License 2.0
from Chem4Word
private void Cancel_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.Cancel;
Hide();
}
19
Source : EditorHost.cs
with Apache License 2.0
from Chem4Word
with Apache License 2.0
from Chem4Word
private void EditorHost_FormClosing(object sender, FormClosingEventArgs e)
{
if (DialogResult != DialogResult.OK && e.CloseReason == CloseReason.UserClosing)
{
if (elementHost1.Child is CmlEditor editor
&& editor.IsDirty)
{
StringBuilder sb = new StringBuilder();
sb.AppendLine("Do you wish to save your changes?");
sb.AppendLine(" Click 'Yes' to save your changes and exit.");
sb.AppendLine(" Click 'No' to discard your changes and exit.");
sb.AppendLine(" Click 'Cancel' to return to the form.");
DialogResult dr = UserInteractions.AskUserYesNoCancel(sb.ToString());
switch (dr)
{
case DialogResult.Cancel:
e.Cancel = true;
break;
case DialogResult.Yes:
DialogResult = DialogResult.OK;
CMLConverter cc = new CMLConverter();
OutputValue = cc.Export(editor.EditedModel);
Hide();
break;
case DialogResult.No:
break;
}
}
}
}
19
Source : EditorHost.cs
with Apache License 2.0
from Chem4Word
with Apache License 2.0
from Chem4Word
private void Save_Click(object sender, EventArgs e)
{
string module = $"{_product}.{_clreplaced}.{MethodBase.GetCurrentMethod().Name}()";
CMLConverter cc = new CMLConverter();
DialogResult = DialogResult.Cancel;
if (elementHost1.Child is Chem4Word.ACME.Editor editor
&& editor.IsDirty)
{
DialogResult = DialogResult.OK;
OutputValue = cc.Export(editor.EditedModel);
}
Telemetry.Write(module, "Verbose", $"Result: {DialogResult}");
Hide();
}
19
Source : EditorHost.cs
with Apache License 2.0
from Chem4Word
with Apache License 2.0
from Chem4Word
private void OnWpfButtonClick(object sender, EventArgs e)
{
string module = $"{_product}.{_clreplaced}.{MethodBase.GetCurrentMethod().Name}()";
WpfEventArgs args = (WpfEventArgs)e;
if (args.Button.ToUpper().Equals("OK"))
{
DialogResult = DialogResult.OK;
CMLConverter cc = new CMLConverter();
JSONConverter jc = new JSONConverter();
Model model = jc.Import(args.OutputValue);
OutputValue = cc.Export(model);
}
if (args.Button.ToUpper().Equals("CANCEL"))
{
DialogResult = DialogResult.Cancel;
OutputValue = "";
}
WpfChemDoodle editor = elementHost1.Child as WpfChemDoodle;
if (editor != null)
{
editor.OnButtonClick -= OnWpfButtonClick;
}
Hide();
}
19
Source : EditorHost.cs
with Apache License 2.0
from Chem4Word
with Apache License 2.0
from Chem4Word
private void Save_Click(object sender, EventArgs e)
{
CMLConverter cc = new CMLConverter();
DialogResult = DialogResult.Cancel;
switch (_editorType)
{
case "ACME":
if (elementHost1.Child is Editor acmeEditor
&& acmeEditor.IsDirty)
{
DialogResult = DialogResult.OK;
var model = acmeEditor.EditedModel;
model.RescaleForCml();
// Replace any temporary Ids which are Guids
model.ReLabelGuids();
OutputValue = cc.Export(model);
}
break;
case "LABELS":
if (elementHost1.Child is LabelsEditor labelsEditor
&& labelsEditor.IsDirty)
{
DialogResult = DialogResult.OK;
OutputValue = cc.Export(labelsEditor.EditedModel);
}
break;
default:
if (elementHost1.Child is CmlEditor cmlEditor
&& cmlEditor.IsDirty)
{
DialogResult = DialogResult.OK;
OutputValue = cc.Export(cmlEditor.EditedModel);
}
break;
}
Hide();
}
19
Source : EditorHost.cs
with Apache License 2.0
from Chem4Word
with Apache License 2.0
from Chem4Word
private void EditorHost_FormClosing(object sender, FormClosingEventArgs e)
{
if (DialogResult != DialogResult.OK && e.CloseReason == CloseReason.UserClosing)
{
StringBuilder sb = new StringBuilder();
sb.AppendLine("Do you wish to save your changes?");
sb.AppendLine(" Click 'Yes' to save your changes and exit.");
sb.AppendLine(" Click 'No' to discard your changes and exit.");
sb.AppendLine(" Click 'Cancel' to return to the form.");
CMLConverter cc = new CMLConverter();
switch (_editorType)
{
case "ACME":
if (elementHost1.Child is Editor acmeEditor
&& acmeEditor.IsDirty)
{
DialogResult dr = UserInteractions.AskUserYesNoCancel(sb.ToString());
switch (dr)
{
case DialogResult.Cancel:
e.Cancel = true;
break;
case DialogResult.Yes:
DialogResult = DialogResult.OK;
var model = acmeEditor.EditedModel;
model.RescaleForCml();
// Replace any temporary Ids which are Guids
model.ReLabelGuids();
OutputValue = cc.Export(model);
Hide();
break;
case DialogResult.No:
break;
}
}
break;
case "LABELS":
if (elementHost1.Child is LabelsEditor labelsEditor
&& labelsEditor.IsDirty)
{
DialogResult dr = UserInteractions.AskUserYesNoCancel(sb.ToString());
switch (dr)
{
case DialogResult.Cancel:
e.Cancel = true;
break;
case DialogResult.Yes:
DialogResult = DialogResult.OK;
OutputValue = cc.Export(labelsEditor.EditedModel);
Hide();
break;
case DialogResult.No:
break;
}
}
break;
default:
if (elementHost1.Child is CmlEditor editor
&& editor.IsDirty)
{
DialogResult dr = UserInteractions.AskUserYesNoCancel(sb.ToString());
switch (dr)
{
case DialogResult.Cancel:
e.Cancel = true;
break;
case DialogResult.Yes:
DialogResult = DialogResult.OK;
OutputValue = cc.Export(editor.EditedModel);
Hide();
break;
case DialogResult.No:
break;
}
}
break;
}
}
}
19
Source : EditorHost.cs
with Apache License 2.0
from Chem4Word
with Apache License 2.0
from Chem4Word
private void Cancel_Click(object sender, EventArgs e)
{
string module = $"{_product}.{_clreplaced}.{MethodBase.GetCurrentMethod().Name}()";
DialogResult = DialogResult.Cancel;
Telemetry.Write(module, "Verbose", $"Result: {DialogResult}");
Hide();
}
See More Examples