public override void FinishedLaunching(NSObject notification) { NSImage img = new NSImage(NSBundle.MainBundle.PathForImageResource("Icon106x106.png")); // create the helpers iHelper = new Helper(Environment.GetCommandLineArgs()); iHelper.ProcessOptionsFileAndCommandLine(); CrashLogDumperWindowController d = new CrashLogDumperWindowController(img, iHelper.Title, iHelper.Product, iHelper.Version); d.LoadWindow(); iHelper.AddCrashLogDumper(d); iHelperAutoUpdate = new HelperAutoUpdate(iHelper, new Linn.Toolkit.Mac.ViewAutoUpdateStandard(img), new Linn.Toolkit.Mac.Invoker()); iHelperAutoUpdate.Start(); // create the xapp components iXapp = new Framework <Session>(Path.Combine(OpenHome.Xen.Environment.AppPath, "PageHtml")); iWebServer = new WebServer(iXapp); iControl = new PageControl(iHelper, iXapp, Path.Combine(OpenHome.Xen.Environment.AppPath, "PageHtml"), "PageDefinitions.xml"); iControl.EventCloseApplicationRequested += CloseApplicationRequested; // create and show the main window iMainWindow = new MainWindowController(); iMainWindow.Window.Title = iHelper.Product; iViewBrowser = new ViewerBrowser(iMainWindow.WebView, iWebServer.ResourceUri); iMainWindow.Window.MakeKeyAndOrderFront(this); }
private void Application_Startup(object sender, StartupEventArgs e) { // create helpers iHelper = new Helper(e.Args); iHelper.ProcessOptionsFileAndCommandLine(); ICrashLogDumper d = new CrashLogDumperWindow(ResourceManager.IconLarge, iHelper.Title, iHelper.Product, iHelper.Version); iHelper.AddCrashLogDumper(d); iHelperAutoUpdate = new HelperAutoUpdate(iHelper, new Linn.Toolkit.Wpf.ViewAutoUpdateStandard(Konfig.ResourceManager.Icon, Konfig.Properties.Resources.IconLarge), new Invoker(this.Dispatcher)); iHelperAutoUpdate.Start(); // create the main window iMainWindow = new MainWindow(iHelper.Product, iHelper.Title); iMainWindow.Show(); Preferences preferences = new Preferences(iHelper); Model.Instance = new Model(preferences); // create the xapp controller and view Invoker invoker = new Invoker(this.Dispatcher); SettingsPageAdvanced settings = new SettingsPageAdvanced(invoker, Model.Instance, preferences, iHelperAutoUpdate, "settings", "settings"); UpdateListenerRepeater listeners = new UpdateListenerRepeater(new IUpdateListener[] { iMainWindow, settings }); iXappController = new XappController(invoker, iHelper, Model.Instance, preferences, settings, listeners); iViewer = new ViewerBrowser(iMainWindow.WebBrowser, iXappController.MainPageUri); }
private void Application_Startup(object sender, StartupEventArgs e) { // this prevents the UI framework from handling unhandled exceptions so that they are let throught // to be handled by the Linn code System.Windows.Forms.Application.SetUnhandledExceptionMode(System.Windows.Forms.UnhandledExceptionMode.ThrowException); // create helpers iHelper = new Helper(e.Args); ICrashLogDumper d = new CrashLogDumperWindow(Wizard.Properties.Resources.Icon, iHelper.Title, iHelper.Product, iHelper.Version); iHelper.AddCrashLogDumper(d); iHelperAutoUpdate = new HelperAutoUpdate(iHelper, new Linn.Toolkit.Wpf.ViewAutoUpdateStandard(Wizard.Properties.Resources.Icon, Wizard.Properties.Resources.IconImage), new Invoker(this.Dispatcher)); iHelperAutoUpdate.Start(); iHelper.ProcessOptionsFileAndCommandLine(); // create components iXapp = new Framework <Session>(Path.Combine(OpenHome.Xen.Environment.AppPath, "PageHtml")); iWebServer = new WebServer(iXapp); iControl = new PageControl(iHelper, iXapp, Path.Combine(OpenHome.Xen.Environment.AppPath, "PageHtml"), "PageDefinitions.xml"); // create the main window iMainWindow = new MainWindow(iHelper, iWebServer.ResourceUri, iControl); iMainWindow.Show(); }
public PageMain(Helper aHelper, OptionPagePrivacy aOptionPagePrivacy, HelperAutoUpdate aHelperAutoUpdate, IStartAtLoginOption aStartAtLoginOption) : base() { iTracker = new OpenHome.Xapp.Tracker(TrackerConfiguration.TrackerAccount(aHelper), this); iOptionPagePrivacy = aOptionPagePrivacy; iHelperAutoUpdate = aHelperAutoUpdate; iStartAtLoginOption = aStartAtLoginOption; iOptionPagePrivacy.EventUsageDataChanged += HandleEventUsageDataChanged; }
public override void AwakeFromNib() { // initialise resigned state iSessionResigned = false; // load some images from the bundle NSImage largeIcon = new NSImage(NSBundle.MainBundle.PathForImageResource("IconLarge.png")); // create the app helper iHelper = new Helper(Environment.GetCommandLineArgs()); iHelper.ProcessOptionsFileAndCommandLine(); // add a crash log dumper CrashLogDumperWindowController d = new CrashLogDumperWindowController(largeIcon, iHelper.Title, iHelper.Product, iHelper.Version); d.LoadWindow(); iHelper.AddCrashLogDumper(d); // create auto update view and helper iHelperAutoUpdate = new HelperAutoUpdate(iHelper, new Linn.Toolkit.Mac.ViewAutoUpdateStandard(largeIcon), new Invoker(), (s, e) => {}); iHelperAutoUpdate.Start(); // create the main songcast model iModel = new Model(new Invoker(), iHelper); iModel.EventEnabledChanged += ModelEnabledChanged; // create the preferences 'view' for communicating with the system preferences app iViewPreferences = new ViewPreferences(new Invoker(), iModel, iHelperAutoUpdate); // creating the status item with a length of -2 is equivalent to the call // [[NSStatusBar systemStatusBar] statusItemWithLength:NSSquareStatusItemLength] iStatusItem = NSStatusBar.SystemStatusBar.CreateStatusItem(-2); iStatusItem.HighlightMode = false; iStatusItem.Target = this; iStatusItem.Action = new Selector("statusItemClicked:"); // setup system event notifications NSNotificationCenter center = NSWorkspace.SharedWorkspace.NotificationCenter; center.AddObserver(this, new Selector("willSleep:"), new NSString("NSWorkspaceWillSleepNotification"), null); center.AddObserver(this, new Selector("didWake:"), new NSString("NSWorkspaceDidWakeNotification"), null); center.AddObserver(this, new Selector("sessionDidResignActive:"), new NSString("NSWorkspaceSessionDidResignActiveNotification"), null); center.AddObserver(this, new Selector("sessionDidBecomeActive:"), new NSString("NSWorkspaceSessionDidBecomeActiveNotification"), null); // create the main window iMainWindow = new MainWindowController(); iMainWindow.LoadWindow(); iMainWindow.Window.DidResignKey += MainWindowDidResignKey; iMainWindow.Window.CollectionBehavior = NSWindowCollectionBehavior.CanJoinAllSpaces; // create the xapp controller and view iXappController = new XappController(iModel, new Invoker()); iXappController.MainPage.EventShowConfig += ShowConfig; iXappController.MainPage.EventShowHelp += ShowHelp; iViewer = new ViewerBrowser(iMainWindow.WebView, iXappController.MainPageUri); }
public SettingsPageAdvanced(IInvoker aInvoker, INetworkManager aNetworkManager, Preferences aPreferences, HelperAutoUpdate aHelperAutoUpdate, string aId, string aViewId) : base(aInvoker, aPreferences, aId, aViewId) { iInvoker = aInvoker; iHelperAutoUpdate = aHelperAutoUpdate; iHelperAutoUpdate.OptionPageUpdates.EventAutoUpdateChanged += HandleAutoUpdateChanged; iHelperAutoUpdate.OptionPageUpdates.EventBetaVersionsChanged += HandleBetaVersionsChanged; iNetworkManager = aNetworkManager; iNetworkManager.AdapterListChanged += AdapterListChanged; iAdapterList = iNetworkManager.AdapterList; }
private void ApplicationStartup(object sender, StartupEventArgs e) { // this prevents the UI framework from handling unhandled exceptions so that they are let throught // to be handled by the Linn code System.Windows.Forms.Application.SetUnhandledExceptionMode(System.Windows.Forms.UnhandledExceptionMode.ThrowException); // create the app helper iHelper = new Helper(Environment.GetCommandLineArgs()); OptionPagePrivacy optionPagePrivacy = new OptionPagePrivacy(iHelper); iHelper.AddOptionPage(optionPagePrivacy); iHelper.ProcessOptionsFileAndCommandLine(); // create crash log dumper ICrashLogDumper d = new CrashLogDumperWindow(Songbox.Properties.Resources.Icon, iHelper.Title, iHelper.Product, iHelper.Version); iHelper.AddCrashLogDumper(d); // create view and helper for auto updates iViewAutoUpdate = new Toolkit.Wpf.ViewAutoUpdateStandard(Songbox.Properties.Resources.Icon, Songbox.Properties.Resources.Image106x106); iViewAutoUpdate.EventButtonUpdateClicked += EventButtonUpdateClicked; iHelperAutoUpdate = new HelperAutoUpdate(iHelper, iViewAutoUpdate, new Invoker(this.Dispatcher)); iHelperAutoUpdate.OptionPageUpdates.BetaVersions = iHelper.BuildType == EBuildType.Beta; iHelperAutoUpdate.Start(); iPageMain = new Linn.Songbox.PageMain(iHelper, optionPagePrivacy, iHelperAutoUpdate, new StartAtLoginOption(iHelper.Title)); IconInfo iconInfo = new IconInfo("logo.png", "image/png", 106, 106, 32); try { // create the media server iServer = new Server("git://github.com/linnoss/MediaApps.git", iHelper.Company, "http://www.linn.co.uk", iHelper.Title, "http://www.linn.co.uk", new Presentation(iPageMain), iconInfo); } catch (ApplicationException) { Shutdown(-1); } // create the configuration window iWindow = new ConfigurationWindow(Songbox.Properties.Resources.Icon, iHelper.Title, iServer); iWindow.Closing += EventWindowClosing; // create and show the sys tray icon iFormSysTray = new FormSysTray(this); }
public override void FinishedLaunching(NSObject notification) { // load images for the status item and windows NSImage sysTrayImage = new NSImage(NSBundle.MainBundle.PathForImageResource("SysTrayIcon.png")); NSImage largeImage = new NSImage(NSBundle.MainBundle.PathForImageResource("Icon106x106.png")); // creating the status item with a length of -2 is equivalent to the call // [[NSStatusBar systemStatusBar] statusItemWithLength:NSSquareStatusItemLength] iStatusItem = NSStatusBar.SystemStatusBar.CreateStatusItem(-2); iStatusItem.HighlightMode = true; iStatusItem.Menu = StatusMenu; iStatusItem.Image = sysTrayImage; // create the app helper iHelper = new Helper(Environment.GetCommandLineArgs()); OptionPagePrivacy optionPagePrivacy = new OptionPagePrivacy(iHelper); iHelper.AddOptionPage(optionPagePrivacy); iHelper.ProcessOptionsFileAndCommandLine(); // create window for crash logging CrashLogDumperWindowController d = new CrashLogDumperWindowController(largeImage, iHelper.Title, iHelper.Product, iHelper.Version); d.LoadWindow(); iHelper.AddCrashLogDumper(d); // create view and helper for the auto updates - hardcode check for beta versions for now IViewAutoUpdate autoUpdateView = new Linn.Toolkit.Mac.ViewAutoUpdateStandard(largeImage); iHelperAutoUpdate = new HelperAutoUpdate(iHelper, autoUpdateView, new Invoker()); iHelperAutoUpdate.OptionPageUpdates.BetaVersions = iHelper.BuildType == EBuildType.Beta; iHelperAutoUpdate.Start(); iPageMain = new Linn.Songbox.PageMain(iHelper, optionPagePrivacy, iHelperAutoUpdate, new StartAtLoginOption()); IconInfo iconInfo = new IconInfo("logo.png", "image/png", 106, 106, 32); // create the media server iServer = new Server("git://github.com/linnoss/MediaApps.git", iHelper.Company, "http://www.linn.co.uk", iHelper.Title, "http://www.linn.co.uk", new Presentation(iPageMain), iconInfo); // create the main configuration window iWindow = new ConfigurationWindowController(iServer, iPageMain); iWindow.LoadWindow(); }
private void Application_Exit(object sender, ExitEventArgs e) { if (iHelperAutoUpdate != null) { iHelperAutoUpdate.Dispose(); iHelperAutoUpdate = null; } if (iXappController != null) { iXappController.Dispose(); iXappController = null; } if (iViewer != null) { iViewer.Dispose(); iViewer = null; } }
public override void FinishedLaunching(NSObject notification) { // load some images from the bundle NSImage largeIcon = new NSImage(NSBundle.MainBundle.PathForImageResource("IconLarge.png")); // create the app helper iHelper = new Helper(Environment.GetCommandLineArgs()); iHelper.ProcessOptionsFileAndCommandLine(); // add a crash log dumper CrashLogDumperWindowController d = new CrashLogDumperWindowController(largeIcon, iHelper.Title, iHelper.Product, iHelper.Version); d.LoadWindow(); iHelper.AddCrashLogDumper(d); // create auto update view and helper iHelperAutoUpdate = new HelperAutoUpdate(iHelper, new Linn.Toolkit.Mac.ViewAutoUpdateStandard(largeIcon), new Invoker()); iHelperAutoUpdate.Start(); iMainWindowController = new MainWindowController(iHelper.Product); MainWindowDelegate windowDelegate = new MainWindowDelegate(iMainWindowController.Window, iHelper.Title, largeIcon); iMainWindowController.Window.Delegate = windowDelegate; iMainWindowController.Window.MakeKeyAndOrderFront(this); Preferences preferences = new Preferences(iHelper); Model.Instance = new Model(preferences); // create the xapp controller and view Invoker invoker = new Invoker(); SettingsPageAdvanced settings = new SettingsPageAdvanced(invoker, Model.Instance, preferences, iHelperAutoUpdate, "settings", "settings"); UpdateListenerRepeater listeners = new UpdateListenerRepeater(new IUpdateListener[] { windowDelegate, settings }); iXappController = new XappController(invoker, iHelper, Model.Instance, preferences, settings, listeners); iViewer = new ViewerBrowser(iMainWindowController.WebView, iXappController.MainPageUri); }
public PreferencesWindow(IHelper aHelper, PreferenceBindings aBindings, Model aModel, HelperAutoUpdate aHelperAutoUpdate) { InitializeComponent(); iModel = aModel; iHelperAutoUpdate = aHelperAutoUpdate; // set the bindings for the window DataContext = aBindings; // fill in about page info textBlockProduct.Text = aHelper.Product; textBlockVersion.Text = string.Format("Version {0} {1}", aHelper.Version, aHelper.Family); textBlockCopyright.Text = aHelper.Copyright; MemoryStream iconStream = new MemoryStream(); ResourceManager.IconSongcaster.Save(iconStream); iconStream.Seek(0, SeekOrigin.Begin); Icon = BitmapFrame.Create(iconStream); image1.Source = ResourceManager.Icon; image2.Source = ResourceManager.ImageRotaryControl; image3.Source = ResourceManager.ImageRockerControl; }
public ViewPreferences(IInvoker aInvoker, Model aModel, HelperAutoUpdate aHelperAutoUpdate) { iInvoker = aInvoker; iAppId = "uk.co.linn.songcast.app"; iModel = aModel; iHelperAutoUpdate = aHelperAutoUpdate; // register the preference keys and default values object[] keys = new object[] { kPreferenceEnabled, kPreferenceReceiverList, kPreferenceSubnetList, kPreferenceSelectedReceiverUdn, kPreferenceSelectedSubnetAddress, kPreferenceMulticastEnabled, kPreferenceMulticastChannel, kPreferenceMusicLatencyMs, kPreferenceVideoLatencyMs, kPreferenceRotaryVolumeControl, kPreferenceAutoUpdatesEnabled, kPreferenceBetaUpdatesEnabled, kPreferenceUsageDataEnabled }; object[] vals = new object[] { false, new NSArray(), new NSArray(), string.Empty, 0, false, 0, iModel.Preferences.DefaultMusicLatencyMs, iModel.Preferences.DefaultVideoLatencyMs, true, true, false, true }; NSUserDefaults.StandardUserDefaults.RegisterDefaults(NSDictionary.FromObjectsAndKeys(vals, keys)); // check the multicast channel - if it is currently the default (0), set it to a random value - this ensures that this // preference is always set to a valid value if (GetIntegerValue(kPreferenceMulticastChannel) == 0) { Random r = new Random(); int byte1 = r.Next(254) + 1; // in range [1,254] int byte2 = r.Next(254) + 1; // in range [1,254] int channel = byte1 << 8 | byte2; NSUserDefaults.StandardUserDefaults.SetInt(channel, kPreferenceMulticastChannel); } // add observers for the distributed notifications from the preferences pane app NSDistributedNotificationCenter centre = NSDistributedNotificationCenter.DefaultCenter as NSDistributedNotificationCenter; NSString prefAppId = new NSString("uk.co.linn.songcast.prefs"); centre.AddObserver(this, new Selector("selectedReceiverChanged:"), new NSString("PreferenceSelectedReceiverChanged"), prefAppId); centre.AddObserver(this, new Selector("selectedSubnetChanged:"), new NSString("PreferenceSelectedSubnetChanged"), prefAppId); centre.AddObserver(this, new Selector("multicastEnabledChanged:"), new NSString("PreferenceMulticastEnabledChanged"), prefAppId); centre.AddObserver(this, new Selector("multicastChannelChanged:"), new NSString("PreferenceMulticastChannelChanged"), prefAppId); centre.AddObserver(this, new Selector("musicLatencyMsChanged:"), new NSString("PreferenceMusicLatencyMsChanged"), prefAppId); centre.AddObserver(this, new Selector("videoLatencyMsChanged:"), new NSString("PreferenceVideoLatencyMsChanged"), prefAppId); centre.AddObserver(this, new Selector("volumeControlClicked:"), new NSString("PreferenceRotaryVolumeControlChanged"), prefAppId); centre.AddObserver(this, new Selector("autoUpdatesEnabledChanged:"), new NSString("PreferenceAutoUpdatesEnabledChanged"), prefAppId); centre.AddObserver(this, new Selector("betaUpdatesEnabledChanged:"), new NSString("PreferenceBetaUpdatesEnabledChanged"), prefAppId); centre.AddObserver(this, new Selector("usageDataEnabledChanged:"), new NSString("PreferenceUsageDataEnabledChanged"), prefAppId); centre.AddObserver(this, new Selector("refreshReceiverListClicked:"), new NSString("RefreshReceiverList"), prefAppId); centre.AddObserver(this, new Selector("checkForUpdatesClicked:"), new NSString("CheckForUpdates"), prefAppId); // hook up event handlers from model events - these changes in the model are reflected in the preference pane iHelperAutoUpdate.OptionPageUpdates.EventChanged += OptionPageUpdatesChanged; iModel.EventEnabledChanged += ModelEnabledChanged; iModel.EventReceiverListChanged += ModelReceiverListChanged; iModel.EventSubnetListChanged += ModelSubnetListChanged; // hook up event handlers from preferences events - the model can change these preferences - all other preferences // are only changed by the preference pane iModel.Preferences.EventSelectedReceiverChanged += PreferencesSelectedReceiverChanged; iModel.Preferences.EventSelectedSubnetChanged += PreferencesSelectedSubnetChanged; // initialise the view with current values of defaults NSUserDefaults.StandardUserDefaults.SetBool(iModel.Enabled, kPreferenceEnabled); NSUserDefaults.StandardUserDefaults[kPreferenceReceiverList] = BuildReceiverList(); NSUserDefaults.StandardUserDefaults[kPreferenceSubnetList] = BuildSubnetList(); NSUserDefaults.StandardUserDefaults.SetString(iModel.Preferences.SelectedReceiverUdn, kPreferenceSelectedReceiverUdn); NSUserDefaults.StandardUserDefaults.SetInt((int)iModel.Preferences.SelectedSubnetAddress, kPreferenceSelectedSubnetAddress); NSUserDefaults.StandardUserDefaults.SetBool(iModel.Preferences.MulticastEnabled, kPreferenceMulticastEnabled); NSUserDefaults.StandardUserDefaults.SetInt((int)iModel.Preferences.MulticastChannel, kPreferenceMulticastChannel); NSUserDefaults.StandardUserDefaults.SetInt((int)iModel.Preferences.MusicLatencyMs, kPreferenceMusicLatencyMs); NSUserDefaults.StandardUserDefaults.SetInt((int)iModel.Preferences.VideoLatencyMs, kPreferenceVideoLatencyMs); NSUserDefaults.StandardUserDefaults.SetBool(iModel.Preferences.RotaryVolumeControl, kPreferenceRotaryVolumeControl); NSUserDefaults.StandardUserDefaults.SetBool(iHelperAutoUpdate.OptionPageUpdates.AutoUpdate, kPreferenceAutoUpdatesEnabled); NSUserDefaults.StandardUserDefaults.SetBool(iHelperAutoUpdate.OptionPageUpdates.BetaVersions, kPreferenceBetaUpdatesEnabled); NSUserDefaults.StandardUserDefaults.SetBool(iModel.Preferences.UsageData, kPreferenceUsageDataEnabled); NSUserDefaults.StandardUserDefaults.Synchronize(); centre.PostNotificationName("PreferenceAllChanged", iAppId, null, true); }
private void Application_Startup(object sender, StartupEventArgs e) { try { // create helpers iHelper = new Helper(e.Args); ICrashLogDumper d = new CrashLogDumperWindow(ResourceManager.Icon, iHelper.Title, iHelper.Product, iHelper.Version); iHelper.AddCrashLogDumper(d); iHelperAutoUpdate = new HelperAutoUpdate(iHelper, new Linn.Toolkit.Wpf.ViewAutoUpdateStandard(ResourceManager.IconSongcaster, Linn.Songcast.Properties.Resources.IconLarge), new Invoker(this.Dispatcher)); iHelperAutoUpdate.Start(); // create the model iModel = new Model(new Invoker(this.Dispatcher), iHelper); iHelper.ProcessOptionsFileAndCommandLine(); // this should be created before PreferencesWindowClosing event can be called or PreferencesWindowClosing will raise a null reference exception iWaitMainWindowClosed = new AutoResetEvent(false); // create the preferences window and controller iPreferencesWindow = new PreferencesWindow(iHelper, new PreferenceBindings(iModel, iHelperAutoUpdate.OptionPageUpdates), iModel, iHelperAutoUpdate); iPreferencesWindow.Closing += PreferencesWindowClosing; iPreferencesWindow.EventButtonHelpClicked += OpenHelp; // create the main window iMainWindow = new MainWindow(); iMainWindow.Deactivated += MainWindowDeactivated; // create the xapp controller and view iXappController = new XappController(iModel, new Invoker(this.Dispatcher)); iXappController.MainPage.EventShowConfig += OpenPreferences; iXappController.MainPage.EventShowHelp += OpenHelp; iViewer = new ViewerBrowser(iMainWindow.WebBrowser, iXappController.MainPageUri); // create the sys tray icon iFormSysTray = new FormSysTray(iModel); iFormSysTray.EventIconClick += SysTrayIconClick; // start the model System.Drawing.Image image = System.Drawing.Image.FromStream(ResourceManager.Icon.StreamSource); System.IO.MemoryStream stream = new System.IO.MemoryStream(); image.Save(stream, System.Drawing.Imaging.ImageFormat.Png); iModel.Start("linn.co.uk", "Linn", "http://www.linn.co.uk", "http://www.linn.co.uk", stream.ToArray(), "image/png"); bool createdNew; iWaitHandleMainWindow = new EventWaitHandle(false, EventResetMode.ManualReset, "LinnSongcastOpenPreferences", out createdNew); if (!createdNew) { iWaitHandleMainWindow.Set(); //MessageBox.Show("Linn Songcast is already running", "Information", MessageBoxButton.OK, MessageBoxImage.Information); App.Current.Shutdown(0); return; } iWaitHandleExit = new EventWaitHandle(false, EventResetMode.ManualReset, "LinnSongcastExit", out createdNew); Assert.Check(createdNew); iThreadMainWindow = new Thread(ProcessOpenMainWindow); iThreadMainWindow.IsBackground = true; iThreadMainWindow.Start(); iThreadExit = new Thread(ProcessExit); iThreadExit.IsBackground = true; iThreadExit.Start(); Microsoft.Win32.SystemEvents.PowerModeChanged += PowerModeChanged; } catch (SongcastError) { MessageBox.Show("Failed to initialise Linn Songcast Driver", "Error", MessageBoxButton.OK, MessageBoxImage.Error); App.Current.Shutdown(1); } }