Пример #1
0
        public void CheckForUpdate()
        {
            if (Delpoyment != null)
            {
                return;
            }

            if (ApplicationDeployment.IsNetworkDeployed)
            {
                UpdateTimer.Stop();

                if (UpdateManagerProgressEvent != null)
                {
                    UpdateManagerProgressEvent(this, "Проверка обновлений...");
                }

                try
                {
                    Delpoyment = ApplicationDeployment.CurrentDeployment;
                    Delpoyment.CheckForUpdateCompleted += CheckForUpdateCompleted;
                    Delpoyment.CheckForUpdateProgressChanged += CheckForUpdateProgressChanged;
                    Delpoyment.CheckForUpdateAsync();
                }
                catch (Exception e)
                {
                    if (UpdateManagerProgressEvent != null)
                    {
                        UpdateManagerProgressEvent(this, "");
                    }
                }                
            }
        }
Пример #2
0
        public void Launch()
        {
            timer.Tick += new EventHandler(timer_Tick);
             timer.Interval = new TimeSpan(0, 0, 1);
             int Number = 0;

             if (ApplicationDeployment.IsNetworkDeployed)
             {
            deployment = ApplicationDeployment.CurrentDeployment;
            deployment.UpdateCompleted += new System.ComponentModel.AsyncCompletedEventHandler(deployment_UpdateCompleted);
            deployment.UpdateProgressChanged += deployment_UpdateProgressChanged;
            deployment.CheckForUpdateCompleted += deployment_CheckForUpdateCompleted;
            try
            {
               deployment.CheckForUpdateAsync();
            }
            catch (InvalidOperationException e)
            {
               Debug.WriteLine(e.ToString());
            }
             }

             foreach (WinForms.Screen s in WinForms.Screen.AllScreens)
             {
            MainWindow m = new MainWindow(this)
                               {
                                  WindowStartupLocation = WindowStartupLocation.Manual,
                                  Left = s.WorkingArea.Left,
                                  Top = s.WorkingArea.Top,
                                  Width = s.WorkingArea.Width,
                                  Height = s.WorkingArea.Height,
                                  WindowStyle = WindowStyle.None,
                                  Topmost = true,
                                  AllowsTransparency = Settings.Default.TransparentBackground,
                              Background = (Settings.Default.TransparentBackground ? new SolidColorBrush(Color.FromArgb(1, 0, 0, 0)) : Brushes.WhiteSmoke),
                                  Name = "Window" + Number++.ToString()
             				};

            ellipsesUserControlQueue[m.Name] = new Queue<UserControl>();

            m.Show();
            m.MouseLeftButtonDown += HandleMouseLeftButtonDown;
            m.MouseWheel += HandleMouseWheel;

            #if false
            m.Width = 700;
            m.Height = 600;
            m.Left = 900;
            m.Top = 500;
            #else
            m.WindowState = WindowState.Maximized;
            #endif
            windows.Add(m);
             }

            //Only show the info label on the FIRST monitor.
             windows[0].infoLabel.Visibility = Visibility.Visible;

             //Startup sound
             audio.PlayWavResourceYield(".Resources.Sounds." + "EditedJackPlaysBabySmash.wav");

             string[] args = Environment.GetCommandLineArgs();
             string ext = System.IO.Path.GetExtension(System.Reflection.Assembly.GetExecutingAssembly().CodeBase);

             if (ApplicationDeployment.IsNetworkDeployed && (ApplicationDeployment.CurrentDeployment.IsFirstRun || ApplicationDeployment.CurrentDeployment.UpdatedVersion != ApplicationDeployment.CurrentDeployment.CurrentVersion))
             {
            //if someone made us a screensaver, then don't show the options dialog.
            if ((args != null && args[0] != "/s") && String.CompareOrdinal(ext, ".SCR") != 0)
            {
               ShowOptionsDialog();
            }
             }
            #if !false
             timer.Start();
            #endif
        }
Пример #3
0
 private void btnUpdate_Click(object sender, EventArgs e)
 {
     if (ApplicationDeployment.IsNetworkDeployed)
     {
         deploy = ApplicationDeployment.CurrentDeployment;
         deploy.CheckForUpdateCompleted += new CheckForUpdateCompletedEventHandler(deploy_CheckForUpdateCompleted);
         deploy.CheckForUpdateProgressChanged += new DeploymentProgressChangedEventHandler(deploy_CheckForUpdateProgressChanged);
         upd.ShowDialog();
         deploy.CheckForUpdateAsync();
     }
 }
Пример #4
0
        private void CheckForUpdates()
        {
            if (ApplicationDeployment.IsNetworkDeployed)
            {
                _appDeploy = ApplicationDeployment.CurrentDeployment;
                _updateDialog = new UpdateDialog
                {
                    WindowStartupLocation = WindowStartupLocation.CenterOwner,
                    Owner = this,
                    TbUpdateStage = {Text = Properties.Resources.UdUpdateStageCheck},
                    Title = Properties.Resources.UdUpdateStageUpdating,
                    AppDeploy = _appDeploy
                };
                _appDeploy.CheckForUpdateProgressChanged -= AppDeployOnCheckForUpdateProgressChanged;
                _appDeploy.CheckForUpdateProgressChanged += AppDeployOnCheckForUpdateProgressChanged;
                _appDeploy.CheckForUpdateCompleted -= AppDeployOnCheckForUpdateCompleted;
                _appDeploy.CheckForUpdateCompleted += AppDeployOnCheckForUpdateCompleted;

                try
                {
                    _appDeploy.CheckForUpdateAsync();
                    _updateDialog.ShowDialog();
                }
                catch (DeploymentDownloadException dde)
                {
                    var messageDialog = new MessageDialog(Properties.Resources.MwDeploymentDownloadException + dde.Message)
                    {
                        Owner = this,
                        WindowStartupLocation = WindowStartupLocation.CenterOwner
                    };
                    messageDialog.ShowDialog();
                }
                catch (InvalidDeploymentException ide)
                {
                    var messageDialog = new MessageDialog(Properties.Resources.MwInvalidDeploymentException + ide.Message)
                    {
                        Owner = this,
                        WindowStartupLocation = WindowStartupLocation.CenterOwner
                    };
                    messageDialog.ShowDialog();
                }
                catch (InvalidOperationException ioe)
                {
                    var messageDialog = new MessageDialog(Properties.Resources.MwInvalidOperationException + ioe.Message)
                    {
                        Owner = this,
                        WindowStartupLocation = WindowStartupLocation.CenterOwner
                    };
                    messageDialog.ShowDialog();
                }
            }
            else
            {
                var messageDialog = new MessageDialog(Properties.Resources.MwWrongAppUpdate)
                {
                    Owner = this,
                    WindowStartupLocation = WindowStartupLocation.CenterOwner
                };
                messageDialog.ShowDialog();
            }
        }
        public void CheckForUpdate()
        {
            if (RestartPending)
                return; //dont let them ruin it

            if (ApplicationDeployment.IsNetworkDeployed)
            {
                if (deployment != null)
                {
                    if (isUpdating)
                        deployment.UpdateAsyncCancel();
                    ;
                    if (isChecking)
                        deployment.CheckForUpdateAsyncCancel();

                    deployment = null;
                    isUpdating = false;
                    isChecking = false;
                }

                deployment = ApplicationDeployment.CurrentDeployment;
                deployment.CheckForUpdateCompleted += VersionCheckComplete;
                Status = STATUS_CHECKINGFORUPDATES;
                isChecking = true;
                deployment.CheckForUpdateAsync();
            }
            else
            {
                deployment = null;
                Status = STATUS_UPTODATE;
                LatestVersion = null;
            }
        }
Пример #6
0
      public void Launch()
      {
         timer.Tick += new EventHandler(timer_Tick);
         timer.Interval = new TimeSpan(0, 0, 1);
         int Number = 0;

         if (ApplicationDeployment.IsNetworkDeployed)
         {
            deployment = ApplicationDeployment.CurrentDeployment;
            deployment.UpdateCompleted += new System.ComponentModel.AsyncCompletedEventHandler(deployment_UpdateCompleted);
            deployment.UpdateProgressChanged += deployment_UpdateProgressChanged;
            deployment.CheckForUpdateCompleted += deployment_CheckForUpdateCompleted;
            try
            {
               deployment.CheckForUpdateAsync();
            }
            catch (InvalidOperationException e)
            {
               Debug.WriteLine(e.ToString());
            }
         }

         foreach (WinForms.Screen s in WinForms.Screen.AllScreens)
         {
            MainWindow m = new MainWindow(this)
                               {
                                  WindowStartupLocation = WindowStartupLocation.Manual,
                                  Left = s.WorkingArea.Left,
                                  Top = s.WorkingArea.Top,
                                  Width = s.WorkingArea.Width,
                                  Height = s.WorkingArea.Height,
                                  WindowStyle = WindowStyle.None,
                                  Topmost = true,
                                  AllowsTransparency = Settings.Default.TransparentBackground,
	                          Background = (Settings.Default.TransparentBackground ? new SolidColorBrush(Color.FromArgb(1, 0, 0, 0)) : Brushes.WhiteSmoke),
                                  Name = "Window" + Number++.ToString()
 				};


            
            ellipsesUserControlQueue[m.Name] = new Queue<UserControl>();

            m.Show();
            m.MouseLeftButtonDown += HandleMouseLeftButtonDown;
            m.MouseWheel += HandleMouseWheel;

#if true
            m.Width = 700;
            m.Height = 600;
            m.Left = 900;
            m.Top = 500;
#else
            m.WindowState = WindowState.Maximized;
#endif
            windows.Add(m);

             //var keyPresses =
             //    Observable.FromEventPattern<KeyEventArgs>(m, "KeyUp").Throttle(TimeSpan.FromMilliseconds(300)).Select(kp => kp.EventArgs.Key.ToString());

             //keyPresses.Subscribe(kp => {
             //   _dictionary.SendKey(kp);
             //});

         }

	    //Only show the info label on the FIRST monitor.
         windows[0].infoLabel.Visibility = Visibility.Visible;

         //Startup sound
         audio.PlayWavResourceYield(".Resources.Sounds." + "EditedJackPlaysBabySmash.wav");

         string[] args = Environment.GetCommandLineArgs();
         string ext = System.IO.Path.GetExtension(System.Reflection.Assembly.GetExecutingAssembly().CodeBase);

         if (ApplicationDeployment.IsNetworkDeployed && (ApplicationDeployment.CurrentDeployment.IsFirstRun || ApplicationDeployment.CurrentDeployment.UpdatedVersion != ApplicationDeployment.CurrentDeployment.CurrentVersion))            
         {
            //if someone made us a screensaver, then don't show the options dialog.
            if ((args != null && args[0] != "/s") && String.CompareOrdinal(ext, ".SCR") != 0)
            {
               ShowOptionsDialog();
            }
         }
#if !false
         timer.Start();
#endif
          _dictionary.AddWord("dog");
          _dictionary.AddWord("cat");
          _dictionary.AddWords("lincoln","preston","damon","mason","clara","mom","dad","cow","ball","car","tractor");

          _dictionary.WordEntered.Subscribe(word => {
              if (_currentlySpeaking != null)
              {
                  Thread.Sleep(300);
                  _currentlySpeaking.ContinueWith(t => SpeakString(word));
              }
              else {
                  this.SpeakString(word);
              }
          });
      }