void Window1_Loaded(object sender, RoutedEventArgs e)
        {
            Logging.Setup();
            Logging.AddToAuthorun();
            ShowInTaskbar = false;
            RegisterHotkey();
            
            _Model = new Model();
            this.DataContext = _Model;
            foreach (string s in Environment.GetCommandLineArgs())
            {
                if (File.Exists(s) && System.IO.Path.GetExtension(s) != ".exe")
                {
                    _Model.Open(s);
                }
            }
            if (!_Model._Loaded) _Model.Load();
            KeyDown += new KeyEventHandler(Window1_KeyDown);
            Closed += new EventHandler(Window1_Closed);
            
            Closing += new System.ComponentModel.CancelEventHandler(Window1_Closing);
            App.Current.Deactivated += new EventHandler(Current_Deactivated);
            _RitchTextBox.Focus();
            _RitchTextBox.TextChanged += new TextChangedEventHandler(RitchTextBox_TextChanged);

            new DispatcherTimer().StartRepeatMethod(60 * 10, Update);
            this.Show(); 
           
            
        }
        public SetName(SetNameViewModel viewModel) {
			InitializeComponent();

            this.DataContext = viewModel;

            Closing += new System.ComponentModel.CancelEventHandler(Upgrade_Closing);
		}
        public PlotterConfigurator()
        {
            InitializeComponent();
            DataContextChanged += new DependencyPropertyChangedEventHandler(PlotterConfigurator_DataContextChanged);

            Closing += new System.ComponentModel.CancelEventHandler(PlotterConfigurator_Closing);
        }
        public DirectoryPickerView()
        {
            InitializeComponent();

            DirectoryPickerViewModel = new DirectoryPickerViewModel();
            DataContext = DirectoryPickerViewModel;
            directoryBrowser.DataContext = DirectoryPickerViewModel;

            DirectoryPickerViewModel.ClosingRequest += new EventHandler<CloseableBindableBase.DialogEventArgs>((s, e) =>
            {

                if (e.DialogMode == CloseableBindableBase.DialogMode.CANCEL)
                {
                    this.DialogResult = false;
                }
                else
                {
                    this.DialogResult = true;
                }
               
                this.Close();
            });

            Closing += new System.ComponentModel.CancelEventHandler((s, e) =>
            {
                directoryBrowser.stopDirectoryPickerInfoGatherTask();
            });
          
        }
Beispiel #5
0
 public ActivityWindow(string displayMessage)
 {
     InitializeComponent();
     m_displayMessage = displayMessage;
     Loaded          += new RoutedEventHandler(ActivityWindow_Loaded);
     Closing         += new System.ComponentModel.CancelEventHandler(ActivityWindow_Closing);
 }
        public override bool Initialize(IPluginHost host)
        {
            Debug.Assert(host != null);
            if (host == null) return false;
            m_host = host;
            global_window_manager_window_added_handler = new EventHandler<GwmWindowEventArgs>(GlobalWindowManager_WindowAdded);
            GlobalWindowManager.WindowAdded += global_window_manager_window_added_handler;
            ToolStripItemCollection tsMenu = m_host.MainWindow.EntryContextMenu.Items;
            m_tsmi_set_template_parent = new ToolStripMenuItem();
            m_tsmi_set_template_parent.Text = "Set Template Parent";
            m_tsmi_set_template_parent.Click += m_tsmi_set_template_parent_Click;
            m_tsmi_set_template_parent.Image = Resources.Resources.B16x16_KOrganizer;
            tsMenu.Add(m_tsmi_set_template_parent);
            m_tsmi_copy_template_string = new ToolStripMenuItem();
            m_tsmi_copy_template_string.Text = "Copy Template String";
            m_tsmi_copy_template_string.Image = Resources.Resources.B16x16_KOrganizer;
            m_dynCustomStrings = new DynamicMenu(m_tsmi_copy_template_string);
            m_dynCustomStrings.MenuClick += m_dynCustomStrings_MenuClick;
            tsMenu.Add(m_tsmi_copy_template_string);

            entry_context_menu_opening_handler = new System.ComponentModel.CancelEventHandler(EntryContextMenu_Opening);
            m_host.MainWindow.EntryContextMenu.Opening += entry_context_menu_opening_handler;
            entry_templates_entry_creating_handler = new EventHandler<TemplateEntryEventArgs>(EntryTemplates_EntryCreating);
            EntryTemplates.EntryCreating += entry_templates_entry_creating_handler;

            return true;
        }
Beispiel #7
0
 /// <summary>
 /// Initialize component of main window
 /// </summary>
 public MainWindow()
 {
     try
     {
         this.DataContext = this;
         InitializeComponent();
         MainCanvas.Focus();
         MainCanvas.MouseUp             += OnMouseUp;
         MainCanvas.MouseMove           += PolygonDrag;
         MainCanvas.MouseLeftButtonDown += MyMouseDownHandler;
         SaveButton.Command              = new SaveCommand();
         polygonesList.Command           = new ShapesCommand();
         this.Title = "Untitled.xml";
         polygonesList.ItemsSource = polygons;
         MainCanvas.KeyUp         += KeyboardDragging;
         Closing += new System.ComponentModel.CancelEventHandler((object sender, System.ComponentModel.CancelEventArgs e) =>
         {
             Save();
             if (!close)
             {
                 e.Cancel = true;
             }
         });
     }
     catch (Exception ex)
     {
         throw new ArgumentException(ex.ToString());
     }
 }
Beispiel #8
0
        public Status()
        {
            InitializeComponent();

#if !SILVERLIGHT
            this.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterOwner;
            this.WindowState           = System.Windows.WindowState.Normal;
#endif

            Expanded      = true;
            statusUpdates = new List <StatusEventArgs>();
            statusErrors  = new List <StatusErrorEventArgs>();
            StatusMessaging.StatusUpdate += new StatusMessaging.StatusUpdateDelegate(StatusMessaging_StatusUpdate);
            StatusMessaging.StatusError  += new StatusMessaging.StatusErrorDelegate(StatusMessaging_StatusError);

#if SILVERLIGHT
            Closing += new EventHandler <System.ComponentModel.CancelEventArgs>(Status_Closing);
#else
            Closing += new System.ComponentModel.CancelEventHandler(Status_Closing);
#endif
            Closed += new EventHandler(Status_Closed);

            TasksData.ItemsSource = statusUpdates;
            ErrorData.ItemsSource = statusErrors;
        }
Beispiel #9
0
        void Window1_Loaded(object sender, RoutedEventArgs e)
        {
            Logging.Setup();
            Logging.AddToAuthorun();
            ShowInTaskbar = false;
            RegisterHotkey();

            _Model           = new Model();
            this.DataContext = _Model;
            foreach (string s in Environment.GetCommandLineArgs())
            {
                if (File.Exists(s) && System.IO.Path.GetExtension(s) != ".exe")
                {
                    _Model.Open(s);
                }
            }
            if (!_Model._Loaded)
            {
                _Model.Load();
            }
            KeyDown += new KeyEventHandler(Window1_KeyDown);
            Closed  += new EventHandler(Window1_Closed);

            Closing += new System.ComponentModel.CancelEventHandler(Window1_Closing);
            App.Current.Deactivated += new EventHandler(Current_Deactivated);
            _RitchTextBox.Focus();
            _RitchTextBox.TextChanged += new TextChangedEventHandler(RitchTextBox_TextChanged);

            new DispatcherTimer().StartRepeatMethod(60 * 10, Update);
            this.Show();
        }
Beispiel #10
0
        public MainWindow()
        {
            InitializeComponent();

            settingsButton.Click += new RoutedEventHandler(settingsButton_Click);
            Closing += new System.ComponentModel.CancelEventHandler(MainWindow_Closing);
        }
Beispiel #11
0
        public WindowMain()
        {
            Instance = this;
            Activated += new EventHandler(WindowMain_Activated);
            Closing += new System.ComponentModel.CancelEventHandler(WindowMain_Closing);
            Application.Current.Exit += new ExitEventHandler(Current_Exit);

            InitializeComponent();

            if (Rawr.WPF.Properties.Settings.Default.UpgradeRequired)
            {
                Rawr.WPF.Properties.Settings.Default.Upgrade();
                Rawr.WPF.Properties.Settings.Default.UpgradeRequired = false;
                Rawr.WPF.Properties.Settings.Default.Save();
            }

            Height = Rawr.WPF.Properties.Settings.Default.WindowHeight;
            Width = Rawr.WPF.Properties.Settings.Default.WindowWidth;
            Top = Rawr.WPF.Properties.Settings.Default.WindowTop;
            Left = Rawr.WPF.Properties.Settings.Default.WindowLeft;
            if (Rawr.WPF.Properties.Settings.Default.WindowState == System.Windows.WindowState.Maximized)
            {
                WindowState = Rawr.WPF.Properties.Settings.Default.WindowState;
            }

            LoadScreen.StartLoading(new EventHandler(LoadFinished));
        }
Beispiel #12
0
        public WindowMain()
        {
            Instance   = this;
            Activated += new EventHandler(WindowMain_Activated);
            Closing   += new System.ComponentModel.CancelEventHandler(WindowMain_Closing);
            Application.Current.Exit += new ExitEventHandler(Current_Exit);

            InitializeComponent();

            if (Rawr.WPF.Properties.Settings.Default.UpgradeRequired)
            {
                Rawr.WPF.Properties.Settings.Default.Upgrade();
                Rawr.WPF.Properties.Settings.Default.UpgradeRequired = false;
                Rawr.WPF.Properties.Settings.Default.Save();
            }

            Height = Rawr.WPF.Properties.Settings.Default.WindowHeight;
            Width  = Rawr.WPF.Properties.Settings.Default.WindowWidth;
            Top    = Rawr.WPF.Properties.Settings.Default.WindowTop;
            Left   = Rawr.WPF.Properties.Settings.Default.WindowLeft;
            if (Rawr.WPF.Properties.Settings.Default.WindowState == System.Windows.WindowState.Maximized)
            {
                WindowState = Rawr.WPF.Properties.Settings.Default.WindowState;
            }

            LoadScreen.StartLoading(new EventHandler(LoadFinished));
        }
        public DirectoryPickerView()
        {
            InitializeComponent();

            DirectoryPickerViewModel = new DirectoryPickerViewModel();
            DataContext = DirectoryPickerViewModel;
            directoryBrowser.DataContext = DirectoryPickerViewModel;

            DirectoryPickerViewModel.ClosingRequest += new EventHandler <CloseableBindableBase.DialogEventArgs>((s, e) =>
            {
                if (e.DialogMode == CloseableBindableBase.DialogMode.CANCEL)
                {
                    this.DialogResult = false;
                }
                else
                {
                    this.DialogResult = true;
                }

                this.Close();
            });

            Closing += new System.ComponentModel.CancelEventHandler((s, e) =>
            {
                directoryBrowser.stopDirectoryPickerInfoGatherTask();
            });
        }
        public override bool Initialize(IPluginHost host)
        {
            Debug.Assert(host != null);
            if (host == null)
            {
                return(false);
            }
            m_host = host;
            global_window_manager_window_added_handler = new EventHandler <GwmWindowEventArgs>(GlobalWindowManager_WindowAdded);
            GlobalWindowManager.WindowAdded           += global_window_manager_window_added_handler;
            ToolStripItemCollection tsMenu = m_host.MainWindow.EntryContextMenu.Items;

            m_tsmi_set_template_parent        = new ToolStripMenuItem();
            m_tsmi_set_template_parent.Text   = "Set Template Parent";
            m_tsmi_set_template_parent.Click += m_tsmi_set_template_parent_Click;
            m_tsmi_set_template_parent.Image  = Resources.Resources.B16x16_KOrganizer;
            tsMenu.Add(m_tsmi_set_template_parent);
            m_tsmi_copy_template_string       = new ToolStripMenuItem();
            m_tsmi_copy_template_string.Text  = "Copy Template String";
            m_tsmi_copy_template_string.Image = Resources.Resources.B16x16_KOrganizer;
            m_dynCustomStrings            = new DynamicMenu(m_tsmi_copy_template_string);
            m_dynCustomStrings.MenuClick += m_dynCustomStrings_MenuClick;
            tsMenu.Add(m_tsmi_copy_template_string);

            entry_context_menu_opening_handler          = new System.ComponentModel.CancelEventHandler(EntryContextMenu_Opening);
            m_host.MainWindow.EntryContextMenu.Opening += entry_context_menu_opening_handler;
            entry_templates_entry_creating_handler      = new EventHandler <TemplateEntryEventArgs>(EntryTemplates_EntryCreating);
            EntryTemplates.EntryCreating += entry_templates_entry_creating_handler;

            return(true);
        }
Beispiel #15
0
        public Status()
        {
            InitializeComponent();

#if !SILVERLIGHT
            this.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterOwner;
            this.WindowState = System.Windows.WindowState.Normal;
#endif

            Expanded = true;
            statusUpdates = new List<StatusEventArgs>();
            statusErrors = new List<StatusErrorEventArgs>();
            StatusMessaging.StatusUpdate += new StatusMessaging.StatusUpdateDelegate(StatusMessaging_StatusUpdate);
            StatusMessaging.StatusError += new StatusMessaging.StatusErrorDelegate(StatusMessaging_StatusError);

#if SILVERLIGHT
            Closing += new EventHandler<System.ComponentModel.CancelEventArgs>(Status_Closing);
#else
            Closing += new System.ComponentModel.CancelEventHandler(Status_Closing);
#endif
            Closed += new EventHandler(Status_Closed);

            TasksData.ItemsSource = statusUpdates;
            ErrorData.ItemsSource = statusErrors;
        }
Beispiel #16
0
        public Inspector()
        {
            InitializeComponent();

            this.SizeChanged += new SizeChangedEventHandler(Inspector_SizeChanged);
            Closing          += new System.ComponentModel.CancelEventHandler(Inspector_Closing);
        }
 public ActivityWindow(string displayMessage)
 {
     InitializeComponent();
     m_displayMessage = displayMessage;
     Loaded += new RoutedEventHandler(ActivityWindow_Loaded);
     Closing += new System.ComponentModel.CancelEventHandler(ActivityWindow_Closing);
 }
Beispiel #18
0
        public MainForm()
        {
            InitializeComponent();

            // The SDK may fire events from arbitrary thread context. Therefore if you want to change
            // the state of controls or windows from any of the SDK' events, you have to use this
            // synchronization context to execute the event handler code on the main GUI thread.
            _syncContext = Cognex.DataMan.SDK.WindowsFormsSynchronizationContext.Current;

            //Setting up WindowsCE-specific event handlers manually, as they are lost from the Designer.cs file upon save
#if !WindowsCE
            cbEnableKeepAlive.CheckedChanged += new System.EventHandler(this.cbEnableKeepAlive_CheckedChanged);
#else
            cbEnableKeepAlive.CheckStateChanged += new System.EventHandler(this.cbEnableKeepAlive_CheckedChanged);
#endif

#if !WindowsCE
            cbLiveDisplay.CheckedChanged += new System.EventHandler(this.cbLiveDisplay_CheckedChanged);
#else
            cbLiveDisplay.CheckStateChanged += new System.EventHandler(this.cbLiveDisplay_CheckedChanged);
#endif

#if !WindowsCE
            cbLoggingEnabled.CheckedChanged += new System.EventHandler(this.cbLoggingEnabled_CheckedChanged);
#else
            cbLoggingEnabled.CheckStateChanged += new System.EventHandler(this.cbLoggingEnabled_CheckedChanged);
#endif

#if !WindowsCE
            FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MainForm_FormClosing);
#else
            Closing += new System.ComponentModel.CancelEventHandler(this.MainForm_FormClosing);
#endif
        }
 public PlotterConfigurator()
 {
   InitializeComponent();
   DataContextChanged += new DependencyPropertyChangedEventHandler(PlotterConfigurator_DataContextChanged);
   
   Closing += new System.ComponentModel.CancelEventHandler(PlotterConfigurator_Closing);
 }
Beispiel #20
0
 public static void CallDialogForReceiver(DialogContent content, Window container)
 {
     container.Dispatcher.BeginInvoke(new Action(() =>
     {
         ViewWindowEx.EnsureActive(container);
         var dialog = new Epxoxy.Controls.MessageDialog(container)
         {
             Title   = content.Title,
             Content = content.Content,
         };
         System.Media.SystemSounds.Beep.Play();
         if (content.PlayMusic)
         {
             MessengerLight.Messenger.Default.Send(new MediaParameters()
             {
                 Action = PlayAction.Play
             });
             System.ComponentModel.CancelEventHandler handler = null;
             handler = (sender, e) =>
             {
                 dialog.Closing -= handler;
                 MessengerLight.Messenger.Default.Send(new MediaParameters()
                 {
                     Action = PlayAction.Stop
                 });
             };
             dialog.Closing += handler;
         }
         dialog.ShowDialog();
     }));
 }
Beispiel #21
0
 private void BindEvent()
 {
     // Drag the window by left mouse button
     MouseLeftButtonDown += new MouseButtonEventHandler((sender, e) =>
     {
         DragMove();
     });
     // Blur style
     Loaded += new RoutedEventHandler((sender, e) =>
     {
         // BlurHelper.EnableBlur(this);
     });
     newActivityWidget.AddClicked             += AddActivity;
     newActivityWidget.CancelClicked          += UnShowNewField;
     activityCardListWidget.EditActivityEvent += EditClicked;
     addButton.Click += new RoutedEventHandler((sender, e) =>
     {
         ShowNewField();
     });
     // Save for every 30 minutes
     timer.Interval = TimeSpan.FromMinutes(30);
     timer.Tick    += new EventHandler((sender, e) =>
     {
         UpdateActivities();
         activityCardListWidget.Save();
     });
     // Save before exit
     Closing += new System.ComponentModel.CancelEventHandler((sender, e) =>
     {
         activityCardListWidget.Save();
     });
 }
        public Upgrade(UpgradeViewModel viewModel)
        {
            InitializeComponent();

            this.DataContext = viewModel;

            Closing += new System.ComponentModel.CancelEventHandler(Upgrade_Closing);
        }
        private void initialize(int sensorIdx)
        {
            isClosed = false;
            Closing += new System.ComponentModel.CancelEventHandler(CameraView_Closing);

            KinectCamera = new KinectCameraControl(sensorIdx);
            KinectCamera.ScreenImage = cameraImage;
        }
        public FontEditor()
        {
            InitializeComponent();
            spw = new SymbolPickerWindow(new SymbolStorage(1, 1, 65, 1250, "Arial", 8f));
            spw.Close();

            Closing += new System.ComponentModel.CancelEventHandler(FontEditorClosing);
        }
Beispiel #25
0
 public SettingsPage()
 {
     InitializeComponent();
     Closing += new System.ComponentModel.CancelEventHandler(SettingsPage_Closing);
     _vm      = DataContext as SettingsViewModel;
     Messenger.Default.Register <Boolean>(this, "GetPassword", b => GetPassword(b));
     Messenger.Default.Register <Boolean>(this, "SaveComplete", b => Close());
 }
Beispiel #26
0
        public YesNoWindow(Control content, IYesNoViewModel vm)
        {
            _content = content;
            _vm      = vm;;

            Loaded  += new RoutedEventHandler(YesNoWindow_Loaded);
            Closing += new System.ComponentModel.CancelEventHandler(YesNoWindow_Closing);
            InitializeComponent();
        }
        public CurveEditorWindow()
        {
            InitializeComponent();

            ElementHost.EnableModelessKeyboardInterop(this);

            KeyDown += new KeyEventHandler(CurveEditorWindow_KeyDown);
            Closing += new System.ComponentModel.CancelEventHandler(CurveEditorWindow_Closing);
        }
Beispiel #28
0
        public MainWindow()
        {
            InitializeComponent();

            casinoView.CasinoViewModel = CasinoViewModel.Load();
            casinoView.CasinoViewModel.Initialise();

            Closing += new System.ComponentModel.CancelEventHandler(MainWindow_Closing);
        }
        public MainWindow()
        {
            InitializeComponent();

            casinoView.CasinoViewModel = CasinoViewModel.Load();
            casinoView.CasinoViewModel.Initialise();

            Closing += new System.ComponentModel.CancelEventHandler(MainWindow_Closing);
        }
        public MainWindow()
        {
            MainViewModel = new MainWindowViewModel();

            InitializeComponent();

            mainGrid.DataContext = MainViewModel;

            Closing += new System.ComponentModel.CancelEventHandler(MainWindow_Closing);
        }
Beispiel #31
0
        public MainWindow()
        {
            InitializeComponent();

            This = this;

            // make it a routed eventhandler so it'll get events already handled
            keyDownHandler = new RoutedEventHandler(RoutedKeyDownHandler);
            AddHandler(KeyDownEvent, keyDownHandler, true);
            AddHandler(KeyUpEvent, new KeyEventHandler(KeyUpHandler), true);
            Closing += new System.ComponentModel.CancelEventHandler(FormClosingHandler);

            RightWindowCommandsOverlayBehavior = WindowCommandsOverlayBehavior.Never;

            try
            {
                // try to load settings
                XmlDocument xmlDocument = new XmlDocument();

                xmlDocument.Load("soundboard.config");

                XmlElement  xelRoot  = xmlDocument.DocumentElement;
                XmlNodeList tabNodes = xelRoot.SelectNodes("/tabs/tab");

                // remove default tabs
                Tabs.Items.Clear();

                foreach (XmlNode node in tabNodes)
                {
                    string name = node["name"].InnerText;

                    MetroTabItem tab = new MetroTabItem();
                    tab.Header = name;
                    Tabs.Items.Add(tab);

                    List <Tuple <string, string> > buttons = new List <Tuple <string, string> >();

                    // read the button data
                    for (int i = 0; i < 10; ++i)
                    {
                        buttons.Add(new Tuple <string, string>(node["button" + i].Attributes["name"].Value, node["button" + i].Attributes["path"].Value));
                    }

                    CreatePageContent(tab, buttons);
                }
            }
            // didn't work? make new stuff!
            catch
            {
                // populate content for "welcome"
                CreateHelpContent((MetroTabItem)Tabs.Items[0]);
            }

            CreateTabContextMenus();
        }
        public CancellableOperationProgressView()
        {
            InitializeComponent();

            DataContextChanged += CancellableOperationProgressView_DataContextChanged;

            Closing += new System.ComponentModel.CancelEventHandler((s, e) =>
            {
                (DataContext as CancellableOperationProgressBase).CancelCommand.Execute();
            });
        }
        public CancellableOperationProgressView()
        {
            InitializeComponent();

            DataContextChanged += CancellableOperationProgressView_DataContextChanged;

            Closing += new System.ComponentModel.CancelEventHandler((s, e) =>
            {
                (DataContext as CancellableOperationProgressBase).CancelCommand.Execute();
            });
        }
        public LoginWindow()
        {
            InitializeComponent();

            Messenger.Default.Register<NotificationMessage>(this, MessageReceived);
            Messenger.Default.Register<NotificationMessage<string>>(this, MessageReceivedS);
            viewModel = (LoginViewModel)DataContext;
            viewModel.Init();

            Closing += new System.ComponentModel.CancelEventHandler(LoginWindow_Closing);
            ServerAddress.Focus();
        }
 public ProgressDlg(Action <TArgument> action)
 {
     if (action == null)
     {
         throw new ArgumentNullException("action");
     }
     this.action = action;
     //InitializeComponent();
     //MaximumSize = Size;
     MaximizeBox = false;
     Closing    += new System.ComponentModel.CancelEventHandler(ProgressDlg_Closing);
 }
Beispiel #36
0
 public MyComboBox()
 {
     DropDownStyle      = ComboBoxStyle.DropDown;
     AutoCompleteMode   = AutoCompleteMode.SuggestAppend;
     AutoCompleteSource = AutoCompleteSource.ListItems;
     BackColor          = System.Drawing.SystemColors.Control;
     FlatStyle          = System.Windows.Forms.FlatStyle.Flat;
     Font        = new System.Drawing.Font("Microsoft Sans Serif", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
     ForeColor   = System.Drawing.Color.FromArgb(((int)(((byte)(28)))), ((int)(((byte)(35)))), ((int)(((byte)(49)))));
     Validating += new System.ComponentModel.CancelEventHandler(this.MyComboBox_Validating);
     DrawMode    = DrawMode.OwnerDrawFixed;
     DrawItem   += new DrawItemEventHandler(this.MyComboBox_DrawItem);
 }
        public AmendmentPageController(YellowstonePathology.Business.Test.AccessionOrder accessionOrder,
            YellowstonePathology.Business.Test.PanelSetOrder panelSetOrder)
        {
            this.m_AmendmentUI = new AmendmentUI(accessionOrder, panelSetOrder);
            InitializeComponent();

            this.DataContext = this;
            Closing += new System.ComponentModel.CancelEventHandler(AmendmentPageController_Closing);
            this.Title = "Amendments for " + panelSetOrder.ReportNo + "   " + accessionOrder.PatientName;

            AmendmentListPage amendmentListPage = new AmendmentListPage(this.m_AmendmentUI);
            this.NavigationFrame.NavigationService.Navigate(amendmentListPage);
        }
Beispiel #38
0
        public LoginWindow()
        {
            InitializeComponent();


            Messenger.Default.Register <NotificationMessage>(this, MessageReceived);
            Messenger.Default.Register <NotificationMessage <string> >(this, MessageReceivedS);
            viewModel = (LoginViewModel)DataContext;
            viewModel.Init();

            Closing += new System.ComponentModel.CancelEventHandler(LoginWindow_Closing);
            ServerAddress.Focus();
        }
Beispiel #39
0
        /// <summary>
        /// Parameterless constructor of application's main window.
        /// </summary>
        public MainWindow()
        {
            InitializeComponent();

            EditOrderButton.IsEnabled  = false;
            DeletOrderButton.IsEnabled = false;
            try
            {
                _storage = new OrdersStorage("storage.xml");
                _storage.CreateIfNotExists();
                var ordersList = _storage.RetrieveAllIds();
                _nextId = ordersList.Count != 0 ? ordersList.Keys.Last() + 1 : 0;
            }
            catch (NullReferenceException e)
            {
                Util.Error("Storage fatal error", e.Message);
                Application.Current.Shutdown();
            }
            this.DataContext = _order;
            _validator       = new Validator(
                new List <TextBox>
            {
                FirstName,
                LastName,
                Email,
                PhoneNumber,
                ClientAddressCity,
                ClientAddressStreet,
                ClientAddressBuildingNumber,
                ShopName,
                ShopAddressCity,
                ShopAddressStreet,
                ShopAddressBuildingNumber,
                GoodsCode,
                GoodsWeight
            },
                Email,
                PhoneNumber);
            ResetOrderInstance();
            Closing += new System.ComponentModel.CancelEventHandler((object sender, System.ComponentModel.CancelEventArgs e) =>
            {
                OnWindowClose(sender, e);
                if (cans)
                {
                    e.Cancel = true;
                }
            });
            _instance = this;
            SetTextBoxAction();
            setUpdater();
        }
        public SettingsWindow()
        {
            InitializeComponent();

            Closing += new System.ComponentModel.CancelEventHandler(Optional_Closing);
            Application.Current.Exit+=new ExitEventHandler(Current_Exit);

            if (Environment.OSVersion.Version.Major < 6)
            {
                AeroSwitcher.IsEnabled = false;

                AeroSwitcher.ToolTip = "Sorry this option only for Vista and above Windows users";
            }
        }
        public MainWindow()
        {
            InitializeComponent();
            solutionModel.OpenOutputSolutionRequested += new WpfClient.UserControls.SolutionBuilderControl.SolutionEventHandler(solutionModel_OpenOutputSolutionRequested);
            LocationChanged        += new EventHandler(MainWindow_LocationChanged);
            SizeChanged            += new SizeChangedEventHandler(MainWindow_SizeChanged);
            Closing                += new System.ComponentModel.CancelEventHandler(MainWindow_Closing);
            mainMenu.ExitRequested += new EventHandler(mainMenu_ExitRequested);

            // get window settings from registry right away
            bool   maximizeWindow = BusinessConfiguration.IsWindowMaximized;
            double width          = BusinessConfiguration.WindowWidth;
            double height         = BusinessConfiguration.WindowHeight;
            double x = BusinessConfiguration.WindowX;

            if (x < 0)
            {
                x = 0;
            }
            double y = BusinessConfiguration.WindowY;

            if (y < 0)
            {
                y = 0;
            }

            // reset the window size from registry settings
            if (maximizeWindow == true)
            {
                // keep window maximized
                WindowState = WindowState.Maximized;
            }
            else
            {
                // resize by width and height
                if (width != DefaultValue.Int)
                {
                    Width = width;
                }
                if (height != DefaultValue.Int)
                {
                    Height = height;
                }
                if (x != DefaultValue.Int && y != DefaultValue.Int)
                {
                    Left = x;
                    Top  = y;
                }
            }
        }
		public ManualUri(string operation, ManualType mtype, string deviceUri) {
			InitializeComponent();
			operationName = operation;
            this.DataContext = this;

			if (mtype == ManualType.ADD) {
				devUri = "http://192.168.0.1/onvif/device_service";
			} else {
				devUri = deviceUri;
			}
			ButtonName = LocalButtons.instance.apply;

            Closing += new System.ComponentModel.CancelEventHandler(Upgrade_Closing);
		}
Beispiel #43
0
        public AppSettings(MainWindow mw)
        {
            InitializeComponent();

            _mw = mw;

            _cameraurl.Text   = Settings.Default.CameraURL;
            _luminance.Text   = Settings.Default.Luminance.ToString();
            _framerate.Text   = Settings.Default.FrameRate.ToString();
            _trim.Text        = Settings.Default.Trim.ToString();
            _compression.Text = Settings.Default.Compression.ToString();

            Closing += new System.ComponentModel.CancelEventHandler(AppSettings_Closing);
        }
        public AppSettings(MainWindow mw)
        {
            InitializeComponent();

            _mw = mw;

            _cameraurl.Text = Settings.Default.CameraURL;
            _luminance.Text = Settings.Default.Luminance.ToString();
            _framerate.Text = Settings.Default.FrameRate.ToString();
            _trim.Text = Settings.Default.Trim.ToString();
            _compression.Text = Settings.Default.Compression.ToString();

            Closing += new System.ComponentModel.CancelEventHandler(AppSettings_Closing);
        }
        public AmendmentPageController(YellowstonePathology.Business.Test.AccessionOrder accessionOrder,
                                       YellowstonePathology.Business.Test.PanelSetOrder panelSetOrder)
        {
            this.m_AmendmentUI = new AmendmentUI(accessionOrder, panelSetOrder);
            InitializeComponent();

            this.DataContext = this;
            Closing         += new System.ComponentModel.CancelEventHandler(AmendmentPageController_Closing);
            this.Title       = "Amendments for " + panelSetOrder.ReportNo + "   " + accessionOrder.PatientName;

            AmendmentListPage amendmentListPage = new AmendmentListPage(this.m_AmendmentUI);

            this.NavigationFrame.NavigationService.Navigate(amendmentListPage);
        }
        /// <summary>
        /// 操作等待窗口
        /// </summary>
        /// <param name="routine">操作调用</param>
        /// <param name="title">提示</param>
        /// <param name="canCancel">是否用户可以取消</param>
        /// <param name="IsIndeterminate">是否为连续模式</param>
        /// <param name="refreshRate">刷新频率</param>
        /// <param name="threadParameter">运行参数(线程自己解析)</param>
        public dlgPorcessWaiting(ProcessRoutineDelegate routine, string title, bool canCancel, bool IsIndeterminate = false, double refreshRate = 1.0, object threadParameter = null)
        {
            InitializeComponent();
            this.Title                    = title;
            processRoutine                = routine;
            this.threadParameter          = threadParameter;
            processingBar.IsIndeterminate = IsIndeterminate;
            this.refreshRate              = refreshRate;

            if (!canCancel)
            {
                btnCancel.Visibility = System.Windows.Visibility.Collapsed;
            }
            Closing += new System.ComponentModel.CancelEventHandler(dlgPorcessWaiting_Closing);
        }
        public MessageEditor()
        {
            ItemExists = new SolidColorBrush(Color.FromArgb(255, 255, 204, 0));

            DestinationTimer = new Timer();
            DestinationTimer.AutoReset = false;
            DestinationTimer.Elapsed += new ElapsedEventHandler(DestinationTimerElapsed);

            StopTimer = new Timer();
            StopTimer.AutoReset = false;
            StopTimer.Elapsed += new ElapsedEventHandler(StopTimerElapsed);

            InitializeComponent();

            Closing += new System.ComponentModel.CancelEventHandler(MessageEditorClosing);
        }
        public DownloadWindow()
        {
            Closing += new System.ComponentModel.CancelEventHandler(Window_Closing);
            //var machin = new Program();

            //download_bar.IsIndeterminate = true;
            InitializeComponent();

            dl_label.Content = this.MyString;

            //download_bar.Value = 1;
            //dl_status.progress = "1";


            //download_bar.Value = double.Parse(dl_status.progress);
        }
Beispiel #49
0
 private FloatingWindow(DockPanel dockPanel)
 {
     Root = dockPanel;
     ShowInTaskbar = false;
     WindowStyle = WindowStyle.ToolWindow;
     WindowStartupLocation = WindowStartupLocation.Manual;
     m_dockOver = new List<IDockable>();
     Loaded += new RoutedEventHandler(FloatingWindow_Loaded);
     Closing += new System.ComponentModel.CancelEventHandler(FloatingWindow_Closing);
     MouseMove += new MouseEventHandler(FloatingWindow_MouseMove);
     MouseUp += new MouseButtonEventHandler(FloatingWindow_MouseUp);
     MouseLeave += new MouseEventHandler(FloatingWindow_MouseLeave);
     Activated += new EventHandler(FloatingWindow_Activated);
     LocationChanged += new EventHandler(FloatingWindow_LocationChanged);
     SizeChanged += new SizeChangedEventHandler(FloatingWindow_SizeChanged);
 }
        public StringTemplateTreeView(System.String label, StringTemplate st)
            : base()
        {
            this.Text = label;

            JTreeStringTemplatePanel tp = new JTreeStringTemplatePanel(new JTreeStringTemplateModel(st), null);
            //UPGRADE_TODO: Method 'javax.swing.JFrame.getContentPane' was converted to 'System.Windows.Forms.Form' which has a different behavior. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1073_javaxswingJFramegetContentPane_3"'
            System.Windows.Forms.Control content = ((System.Windows.Forms.ContainerControl) this);
            //UPGRADE_TODO: Method 'java.awt.Container.add' was converted to 'System.Windows.Forms.ContainerControl.Controls.Add' which has a different behavior. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1073_javaawtContaineradd_javaawtComponent_javalangObject_3"'
            content.Controls.Add(tp);
            tp.Dock = System.Windows.Forms.DockStyle.Fill;
            tp.BringToFront();
            //UPGRADE_NOTE: Some methods of the 'java.awt.event.WindowListener' class are not used in the .NET Framework. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1308_3"'
            Closing += new System.ComponentModel.CancelEventHandler(new AnonymousClassWindowAdapter(this).windowClosing);
            //UPGRADE_TODO: Method 'java.awt.Component.setSize' was converted to 'System.Windows.Forms.Control.Size' which has a different behavior. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1073_javaawtComponentsetSize_int_int_3"'
            Size = new System.Drawing.Size(WIDTH, HEIGHT);
        }
	internal QRCodeDecoderGUIExample()
	{
		System.Console.Out.WriteLine("Starting QRCode Decoder GUI Example ...");
		//UPGRADE_TODO: Method 'java.awt.Component.setSize' was converted to 'System.Windows.Forms.Control.Size' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaawtComponentsetSize_int_int'"
		Size = new System.Drawing.Size(400, 400);
		Closing += new System.ComponentModel.CancelEventHandler(this.QRCodeDecoderGUIExample_Closing_EXIT_ON_CLOSE);
		menuBar = new System.Windows.Forms.MainMenu();
		openMenu = new System.Windows.Forms.MenuItem();
		openMenu.Text = "Open Image";
		openMenu.Click += new System.EventHandler(this.actionPerformed);
		SupportClass.CommandManager.CheckCommand(openMenu);
		menuBar.MenuItems.Add(openMenu);
		Menu = menuBar;
		//UPGRADE_TODO: Constructor 'javax.swing.JTextField.JTextField' was converted to 'System.Windows.Forms.TextBox' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaxswingJTextFieldJTextField_int'"
		url = new System.Windows.Forms.TextBox();
		//UPGRADE_TODO: Method 'javax.swing.text.JTextComponent.setText' was converted to 'System.Windows.Forms.TextBoxBase.Text' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaxswingtextJTextComponentsetText_javalangString'"
		url.Text = "(Or input image url here.)";
		button = SupportClass.ButtonSupport.CreateStandardButton("Open from URL");
		button.Click += new System.EventHandler(this.actionPerformed);
		SupportClass.CommandManager.CheckCommand(button);
		System.Windows.Forms.Panel urlPanel = new System.Windows.Forms.Panel();
		//UPGRADE_TODO: Method 'java.awt.Container.add' was converted to 'System.Windows.Forms.ContainerControl.Controls.Add' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaawtContaineradd_javaawtComponent'"
		urlPanel.Controls.Add(url);
		//UPGRADE_TODO: Method 'java.awt.Container.add' was converted to 'System.Windows.Forms.ContainerControl.Controls.Add' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaawtContaineradd_javaawtComponent'"
		urlPanel.Controls.Add(button);
		button = SupportClass.ButtonSupport.CreateStandardButton("URL");
		//UPGRADE_TODO: Method 'javax.swing.JFrame.getContentPane' was converted to 'System.Windows.Forms.Form' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaxswingJFramegetContentPane'"
		//UPGRADE_TODO: Method 'java.awt.Container.add' was converted to 'System.Windows.Forms.ContainerControl.Controls.Add' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaawtContaineradd_javaawtComponent_javalangObject'"
		((System.Windows.Forms.ContainerControl) this).Controls.Add(urlPanel);
		urlPanel.Dock = System.Windows.Forms.DockStyle.Top;
		urlPanel.SendToBack();
		//UPGRADE_TODO: Constructor may need to be changed depending on function performed by the 'System.Windows.Forms.FileDialog' object. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1270'"
		chooser = SupportClass.FileDialogSupport.CreateOpenFileDialog("Open QR Code Image");
		//UPGRADE_ISSUE: Method 'javax.swing.JFileChooser.setFileFilter' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_javaxswingJFileChoosersetFileFilter_javaxswingfilechooserFileFilter'"
		chooser.setFileFilter(new ImageFileFilter());
		//UPGRADE_TODO: Method 'java.awt.Component.setLocation' was converted to 'System.Windows.Forms.Control.Location' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaawtComponentsetLocation_int_int'"
		Location = new System.Drawing.Point(300, 200);
		SupportClass.SelectText(url, 0, url.Text.Length);
		//UPGRADE_TODO: Method 'java.awt.Component.setVisible' was converted to 'System.Windows.Forms.Control.Visible' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaawtComponentsetVisible_boolean'"
		//UPGRADE_TODO: 'System.Windows.Forms.Application.Run' must be called to start a main form. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1135'"
		Visible = true;
	}
        public MainWindow()
        {
            InitializeComponent();
            Closing += new System.ComponentModel.CancelEventHandler(OnClosing);

            if (CLNUIDevice.GetDeviceCount() < 1)
            {
                MessageBox.Show("Is the Kinect plugged in?");
                Environment.Exit(0);
            }

            string serialString = CLNUIDevice.GetDeviceSerial(0);
            camera = CLNUIDevice.CreateCamera(serialString);

            colorImage = new NUIImage(640, 480);
            depthImage = new NUIImage(640, 480);
            rawImage = new NUIImage(640, 480);

            color.Source = colorImage.BitmapSource;
            depth.Source = depthImage.BitmapSource;

            running = true;
            captureThread = new Thread(delegate()
            {
                if (CLNUIDevice.StartCamera(camera))
                {
                    while (running)
                    {
                        CLNUIDevice.GetCameraColorFrameRGB32(camera, colorImage.ImageData, 0);
                        CLNUIDevice.GetCameraDepthFrameRGB32(camera, depthImage.ImageData, 0);
                        CLNUIDevice.GetCameraDepthFrameRAW(camera, rawImage.ImageData, 0);
                        Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action)delegate()
                        {
                            colorImage.Invalidate();
                            depthImage.Invalidate();
                        });
                    }
                }
            });
            captureThread.IsBackground = true;
            captureThread.Start();
        }
Beispiel #53
0
 public MainWindow()
 {
     InitializeComponent();
     Closing += new System.ComponentModel.CancelEventHandler(MainWindow_Closing);
     try
     {
         _devCount = CLNUIDevice.GetDeviceCount();
         if (_devCount == 0)
         {
             Environment.Exit(0);
         }
         for (int i = 0; i < _devCount; i++)
         {
             string devSerial = CLNUIDevice.GetDeviceSerial(i);
             cameras.Items.Add(string.Format("Kinect Serial: {0}", devSerial));
             cameraWindows[i] = new CameraWindow(devSerial);
             cameraWindows[i].Show();
         }
     }
     catch { }
 }
        int _trim; // as recorded in Settings

        #endregion Fields

        #region Constructors

        public MainWindow()
        {
            InitializeComponent();

            string dir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);

            //_ntconnection = new NetworkTableConnection();
            //_ntconnection.Connect();
            //_smartdashboard = _ntconnection.GetTable("/SmartDashboard");

            SizeChanged += new SizeChangedEventHandler(MainWindow_SizeChanged);
            Closing += new System.ComponentModel.CancelEventHandler(MainWindow_Closing);

            _tmppath = System.IO.Path.Combine(System.IO.Path.GetTempPath(), "tmpimg.jpg");

            _direction.Background = Brushes.Firebrick;
            _direction.Foreground = Brushes.Yellow;
            _direction.FontSize = 20;

            _report.Background = Brushes.White;
            _report.TextAlignment = TextAlignment.Left;
            _report.FontFamily = new FontFamily("Courier New");
            _report.FontSize = 16;

            dispatcherTimer = new System.Windows.Threading.DispatcherTimer();
            dispatcherTimer.Tick += new EventHandler(dispatcherTimer_Tick);
            dispatcherTimer.Interval = new TimeSpan(0, 0, 0, 0, 1);
            dispatcherTimer.Start();

            Left = Settings.Default.Left;
            Top = Settings.Default.Top;
            Width = Settings.Default.Width;
            Height = Settings.Default.Height;

            Start();
        }
 public ViewQuizResults()
 {
     InitializeComponent();
     Closing += new System.ComponentModel.CancelEventHandler(ViewQuizResults_Closing);
 }
Beispiel #56
0
        public LoggerWindow()
        {
            InitializeComponent();

            Closing += new System.ComponentModel.CancelEventHandler(LoggerWindow_Closing);
        }
Beispiel #57
0
        public CameraWindow(string devSerial)
        {
            InitializeComponent();
            Closing += new System.ComponentModel.CancelEventHandler(OnClosing);

            xp.Minimum = -981;
            xp.Maximum = 981;
            yp.Minimum = -981;
            yp.Maximum = 981;
            zp.Minimum = -981;
            zp.Maximum = 981;

            try
            {
                motor = CLNUIDevice.CreateMotor(devSerial);
                camera = CLNUIDevice.CreateCamera(devSerial);
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message);
                Environment.Exit(0);
            }

            CLNUIDevice.SetMotorPosition(motor, 0);

            serial.Content = string.Format("Serial Number: {0}", devSerial);
            accelerometerTimer = new DispatcherTimer(TimeSpan.FromMilliseconds(100), DispatcherPriority.Normal, (EventHandler)delegate(object sender, EventArgs e)
            {
                short _x = 0, _y = 0, _z = 0;
                CLNUIDevice.GetMotorAccelerometer(motor, ref _x, ref _y, ref _z);
                x.Content = _x.ToString();
                xp.Value = _x;
                y.Content = _y.ToString();
                yp.Value = _y;
                z.Content = _z.ToString();
                zp.Value = _z;
            }, Dispatcher);
            accelerometerTimer.Start();

            led.SelectionChanged += new SelectionChangedEventHandler(led_SelectionChanged);
            led.SelectedIndex = 0;

            colorImage = new NUIImage(640, 480);
            color.Source = colorImage.BitmapSource;

            depthImage = new NUIImage(640, 480);
            depth.Source = depthImage.BitmapSource;

            running = true;
            captureThread = new Thread(delegate()
            {
            //                 Trace.WriteLine(string.Format("Camera {0:X}", camera.ToInt32()));
                if (CLNUIDevice.StartCamera(camera))
                {
                    while (running)
                    {
                        CLNUIDevice.GetCameraColorFrameRGB32(camera, colorImage.ImageData, 500);
                        CLNUIDevice.GetCameraDepthFrameRGB32(camera, depthImage.ImageData, 0);
                        Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action)delegate()
                        {
                            colorImage.Invalidate();
                            depthImage.Invalidate();
                        });
                    }
                    CLNUIDevice.StopCamera(camera);
                }
            });
            captureThread.IsBackground = true;
            captureThread.Start();
        }
Beispiel #58
0
		public ShellView()
		{
			InitializeComponent();
			Closing += new System.ComponentModel.CancelEventHandler(ShellView_Closing);
		}
Beispiel #59
0
 public BrowserPage()
 {
     InitializeComponent();
     Closing += new System.ComponentModel.CancelEventHandler(BrowserPage_Closing);
 }
        /// <summary>
        /// Create a new MessageBoxWindow, with the given options if non-null - otherwise use the DefaultOptions.
        /// </summary>
        /// <param name="options">The options to use for this particular message-box invocation. Set this to null to use the DefaultOptions.</param>
        public MessageBoxWindow(MessageBox mgr, MessageBoxConfiguration options)
        {
            //Console.WriteLine("MessageBoxWindow ctor, with options.BackgroundTexture = " + options.BackgroundTexture.ToString());
            _manager = mgr;
            // _options has to be set before InitializeComponent, since that causes properties to be bound, and hence the DataContext creates it's view-model.
            if (options == null)
            {
                _options = mgr.Configuration;
            }
            else
            {
                _options = options;
            }
            _viewModel = MessageBoxViewModel.GetInstance(mgr, _options);

            InitializeComponent();

            // Ensure the timeout value isn't ridiculously high (as when the caller mistakenly thinks it's in milliseconds).
            // Use the constant upper-limit value to test it against.
            if (_options.TimeoutPeriodInSeconds > MessageBoxConfiguration.MaximumTimeoutPeriodInSeconds)
            {
                _options.TimeoutPeriodInSeconds = MessageBoxConfiguration.MaximumTimeoutPeriodInSeconds;
            }
            else if (_options.TimeoutPeriodInSeconds == 0)
            {
                // Since it was given a zero timeout -- assign the actual default value that it should be for this type.
                _options.TimeoutPeriodInSeconds = MessageBox.DefaultConfiguration.GetDefaultTimeoutValueFor(_options.MessageType);
            }

            if (_options.IsToCenterOverParent)
            {
                this.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterOwner;
            }

            // If the option to use custom styles for the buttons is turned off, then set these button styles to null
            // so that they do not inherit the styles of the parent application.
            if (!MessageBox.DefaultConfiguration.IsCustomButtonStyles)
            {
                btnCancel.Style = btnClose.Style = btnNo.Style = btnOk.Style = btnRetry.Style = btnYes.Style = btnIgnore.Style = null;
            }

#if SILVERLIGHT
            _viewModel.CopyCommand = new RelayCommand(
                () => OnCopyCommandExecuted()
            );
            _viewModel.StayCommand = new RelayCommand(
                () => OnStayCommandExecuted(),
                () => StayCommand_CanExecute()
            );
#else
            _viewModel.CopyCommand = new RelayCommand(
                (x) => OnCopyCommandExecuted()
            );
            _viewModel.StayCommand = new RelayCommand(
                (x) => OnStayCommandExecuted(),
                (x) => StayCommand_CanExecute()
            );
#endif

            Loaded += OnLoaded;
#if SILVERLIGHT
            Closing += new EventHandler<System.ComponentModel.CancelEventArgs>(OnClosing);
#else
            ContentRendered += OnContentRendered;
            Closing += new System.ComponentModel.CancelEventHandler(OnClosing);
#endif
        }