Exemple #1
0
 private void MainWindowClosed(object sender, EventArgs e)
 {
     if (MenuItemSwitchListen.IsChecked)
     {
         MenuItemSwitchListen.RaiseEvent(new RoutedEventArgs(MenuItem.ClickEvent));
     }
     MenuStrip.Dispose();
     notify.Dispose();
     if (!RestartMainWindow)
     {
         app.Shutdown();
     }
 }
        private void MainWindowSourceInitialized(object sender, EventArgs e)
        {
            CommandBindings.Add
            (
                new CommandBinding
                (
                    ApplicationCommands.Save,
                    SaveCmdExecuted,
                    CmdCanExecute
                )
            );
            MenuItemSave.Command = ApplicationCommands.Save;
            ButtonSave.Command   = ApplicationCommands.Save;
            CommandBindings.Add
            (
                new CommandBinding
                (
                    ApplicationCommands.Print,
                    PrintCmdExecuted,
                    CmdCanExecute
                )
            );
            MenuItemPrint.Command = ApplicationCommands.Print;
            ButtonPrint.Command   = ApplicationCommands.Print;
            CommandBindings.Add
            (
                new CommandBinding
                (
                    ApplicationCommands.Delete,
                    DeleteCmdExecuted,
                    CmdCanExecute
                )
            );
            MenuItemClipboardClear.Command = ApplicationCommands.Delete;
            ButtonClipboardClear.Command   = ApplicationCommands.Delete;
//
            if (IsAutorun)
            {
                TrayMinimize = true;
            }
            cl = new ClipboardListener
                 (
                this,
                new List <string>()
            {
                DataFormats.Rtf,
                DataFormats.UnicodeText,
                DataFormats.Text,
                DataFormats.OemText,
                DataFormats.FileDrop,
                "FileNameW",
                "FileName",
                DataFormats.Bitmap,
                DataFormats.Dib,
                "Format17"
            },
                ClipboardUpdated
                 );
            MenuItemSwitchListen.RaiseEvent
            (
                new RoutedEventArgs(MenuItem.ClickEvent)
            );
        }