예제 #1
0
        override protected void OnStart()
        {
            appViewModel     = new PeerCastAppViewModel(Application);
            versionChecker   = new PeerCastStation.UI.Updater();
            notifyIconThread = new Thread(() => {
                notifyIconManager = new NotifyIconManager(appViewModel, this);
                versionChecker.NewVersionFound += (sender, e) => {
                    notifyIconManager.NotifyNewVersions(e.VersionDescriptions);
                };
                notifyIconManager.Run();
            });
            notifyIconThread.SetApartmentState(ApartmentState.STA);
            notifyIconThread.Start();
            versionCheckTimer = new Timer(OnVersionCheckTimer, null, 1000, 1000 * 3600 * 24);

            mainThread = new Thread(() => {
                var app      = new Application();
                var settings = Application.Settings.Get <WPFSettings>();
                mainWindow   = new MainWindow(appViewModel);
                if (settings.ShowWindowOnStartup)
                {
                    mainWindow.Show();
                }
                app.Run();
            });
            mainThread.Name = "WPF UI Thread";
            mainThread.SetApartmentState(ApartmentState.STA);
            mainThread.Start();
            Application.MessageNotified += OnMessageNotified;
        }
예제 #2
0
    override protected void OnStart()
    {
      appViewModel = new PeerCastAppViewModel(Application);
      versionChecker = new PeerCastStation.UI.Updater();
      notifyIconThread = new Thread(() => {
        notifyIconManager = new NotifyIconManager(appViewModel, this);
        versionChecker.NewVersionFound += (sender, e) => {
          notifyIconManager.NotifyNewVersions(e.VersionDescriptions);
        };
        notifyIconManager.Run();
      });
      notifyIconThread.SetApartmentState(ApartmentState.STA);
      notifyIconThread.Start();
      versionCheckTimer = new Timer(OnVersionCheckTimer, null, 1000, 1000*7200);

      mainThread = new Thread(() => {
        var app = new Application();
        var settings = Application.Settings.Get<WPFSettings>();
        mainWindow = new MainWindow(appViewModel);
        if (settings.ShowWindowOnStartup) mainWindow.Show();
        app.Run();
      });
      mainThread.Name = "WPF UI Thread";
      mainThread.SetApartmentState(ApartmentState.STA);
      mainThread.Start();
    }