示例#1
0
        public void Start()
        {
            AnnouncerTask = new Task(() =>
            {
                AnnouncerStartWindow parent = this;

                Settings.Volatile.TryAttachAnnouncer();
            });
            AnnouncerTask.ContinueWith(task =>
            {
                Dispatcher.Invoke(() =>
                {
                    if (task.IsFaulted)
                    {
                        MessageBox.Show(
                            "An error occured while trying to start the announcer.\n\n"
                            + "\n\n" + task.Exception?.ToString(), "Announcer error",
                            MessageBoxButton.OK, MessageBoxImage.Error);
                    }

                    this.Close();
                });
            });
            AnnouncerTask.Start();
        }
示例#2
0
        public static AnnouncerStartWindow ShowAndStart()
        {
            AnnouncerStartWindow wnd = new AnnouncerStartWindow();

            wnd.Show();
            wnd.Start();

            return(wnd);
        }