protected override void OnStartup(StartupEventArgs args) { base.OnStartup(args); var window = new PreCodeWindow(new PreCodeSettings(), PreCodeWindow.Mode.StandAlone); window.ShowDialog(); if (window.DialogResult.HasValue && window.DialogResult.Value) { System.Diagnostics.Debug.WriteLine("OK"); Clipboard.SetText(window.Code); } else { System.Diagnostics.Debug.WriteLine("Not OK"); } AppSettings.Default.Save(); }
public override DialogResult CreateContent(System.Windows.Forms.IWin32Window dialogOwner, ref string content) { try { var window = new PreCodeWindow(settings, PreCodeWindow.Mode.WLW) { ShowInTaskbar = false }; window.ShowDialog(); if (window.DialogResult.HasValue && window.DialogResult.Value) { content = window.Code; } return(DialogResult.OK); } catch (Exception ex) { MessageBox.Show(String.Format("An error occured in PreCodeWindow: {0}", ex.Message)); return(DialogResult.Cancel); } }