public SilentUpdater()
 {
     if (!ApplicationDeployment.IsNetworkDeployed)
         return;
     applicationDeployment = ApplicationDeployment.CurrentDeployment;
     applicationDeployment.UpdateCompleted += UpdateCompleted;
     applicationDeployment.UpdateProgressChanged += UpdateProgressChanged;
     timer.Elapsed += (sender, args) =>
                          {
                              if (processing)
                                  return;
                              processing = true;
                              try
                              {
                                  if (applicationDeployment.CheckForUpdate(false))
                                      applicationDeployment.UpdateAsync();
                                  else
                                      processing = false;
                              }
                              catch(Exception ex)
                              {
                                  Debug.WriteLine("Check for update failed. " + ex.Message);
                                  processing = false;
                              }
                          };
     timer.Start();
 }
 public MainWindow()
 {
     InitializeComponent();
     this.Loaded += MainWindow_Loaded;
     ad = ApplicationDeployment.CurrentDeployment;
     ad.CheckForUpdateCompleted += ad_CheckForUpdateCompleted;
 }
Beispiel #3
0
        private void frmSplash_Load(object sender, EventArgs e)
        {
            this.ShowInTaskbar = false;
            this.TopMost       = true;
            this.TopLevel      = true;

            //tOpacity.Interval = 100;
            tOpacity.Tick   += new EventHandler(TOpacity_Tick);
            tOpacity.Enabled = true;
            this.Opacity     = 0.0;

            if (ApplicationDeployment.IsNetworkDeployed)
            {
                System.Deployment.Application.ApplicationDeployment appDeployment = ApplicationDeployment.CurrentDeployment;

                string sVersion = "v" + appDeployment.CurrentVersion.Major + "." + appDeployment.CurrentVersion.Minor + "." + appDeployment.CurrentVersion.Build + " Build " + appDeployment.CurrentVersion.Revision;
                lblVersion.Text = sVersion;
            }
            //var thisApp = Assembly.GetExecutingAssembly();
            //AssemblyName name = new AssemblyName(thisApp.FullName);
            //string VersionNumber = "v" + name.Version;
            //lblVersion.Text = VersionNumber;

            t.Tick    += new EventHandler(Timer_Tick);
            t.Interval = 1000;
            t.Start();
        }
Beispiel #4
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, "");
                    }
                }                
            }
        }
Beispiel #5
0
        public static void TestMethod()
        {
            var z  = new Application.ApplicationDeployment();
            var z1 = new System.Deployment.Application.ApplicationDeployment();

            System.Deployment.Application.Foo.Bar x = null;
        }
Beispiel #6
0
 public AppDeployment(ILog logger) {
     _Logger = logger;
     if (ApplicationDeployment.IsNetworkDeployed) {
         _Deployment = ApplicationDeployment.CurrentDeployment;
         _Deployment.CheckForUpdateCompleted += DeploymentCheckForUpdateCompleted;
         _Deployment.UpdateCompleted += DeploymentUpdateCompleted;
     }
 }
 static UpdateManager()
 {
     if (ApplicationDeployment.IsNetworkDeployed)
     {
         AppDeployment = ApplicationDeployment.CurrentDeployment;
         AppDeployment.CheckForUpdateCompleted += new CheckForUpdateCompletedEventHandler(AppDeployment_CheckForUpdateCompleted);
         AppDeployment.UpdateCompleted += new System.ComponentModel.AsyncCompletedEventHandler(AppDeployment_UpdateCompleted);
     }
 }
 private void PublishVersion()
 {
     if (System.Deployment.Application.ApplicationDeployment.IsNetworkDeployed)
     {
         System.Deployment.Application.ApplicationDeployment cd =
             System.Deployment.Application.ApplicationDeployment.CurrentDeployment;
         Version pubVersion = cd.CurrentVersion;
         publishVersion.Text = string.Format("Versija: {0}.{1}.{2}.{3}", pubVersion.Major, pubVersion.Minor, pubVersion.Build, pubVersion.Revision);
     }
 }
        /// <summary>
        /// Updates the ClickOnce application.
        /// </summary>
        /// <param name="currentDeployment">The current deployment.</param>
        /// <returns></returns>
        protected virtual UpdateResult UpdateApplication(ApplicationDeployment currentDeployment)
        {
            var info = currentDeployment.CheckForDetailedUpdate();

            if (!info.UpdateAvailable)
                return NoUpdateNeededResult();

            var message = string.Empty;
            return UpdateCurrentDeployment(currentDeployment, ref message) ? 
                SuccessResult(info) : FailResult(message);
        }
Beispiel #10
0
        public HttpRequest MemberTest()
        {
            var x = HttpRequest.RawUrl;

            System.Web.HttpRequest request1;
            Microsoft.AspNetCore.Http.HttpRequest request2;
            HttpRequest request3;

            x = request1.RawUrl;
            x = request2.RawUrl;
            x = request3.RawUrl;

            var y = System.Web.HttpRequest.RawUrl;
        }
Beispiel #11
0
        public frmMainWindow()
        {
            InitializeComponent();

            thisForm = this;

            // naslovna linija (ispis trenutne verzije)
            string windowTitle = "Elbraco Web Kroler - Verzija ";

            if (System.Deployment.Application.ApplicationDeployment.IsNetworkDeployed)
            {
                System.Deployment.Application.ApplicationDeployment cd =
                    System.Deployment.Application.ApplicationDeployment.CurrentDeployment;
                windowTitle += cd.CurrentVersion;
            }

            this.Text = windowTitle;
        }
        /// <summary>
        /// Updates the current deployment.
        /// </summary>
        /// <param name="deployment">The deployment.</param>
        /// <param name="message">The message.</param>
        /// <returns></returns>
        protected override bool UpdateCurrentDeployment(ApplicationDeployment deployment, ref string message)
        {
            //Call VSTOInstaller Explicitly in "Silent Mode"
            var installerPath = GetInstallerPath();
            if (installerPath == null)
            {
                message = "Cannot resolve VSTO Installer installation path";
                return false;
            }
            var installerArgs = string.Format(" /S /I {0}", deployment.UpdateLocation.AbsoluteUri);

            var vstoInstallerOutput = new StringBuilder();

            var vstoStartInfo = new ProcessStartInfo(installerPath, installerArgs);
            var returnCode = vstoStartInfo.StartProcess((sender, e) => vstoInstallerOutput.Append((string) e.Data));

            message = vstoInstallerOutput.ToString();
            return returnCode == 0;
        }
Beispiel #13
0
 public void CheckUpdate(object source, System.Timers.ElapsedEventArgs e)
 {
     try
     {
         // 取得目前使用者的版本資訊
         System.Deployment.Application.ApplicationDeployment applicationDeployment = ApplicationDeployment.CurrentDeployment;
         // 比對伺服器上的版本
         if (ApplicationDeployment.CurrentDeployment.CheckForUpdate())
         {
             if (MessageBox.Show("Find New Version, Update to the New Version?", "Update Information", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
             {
                 //ProgUpdate.Visible = true;
                 //obj.UpdateProgressChanged += new DeploymentProgressChangedEventHandler(UpdateProgressChanged);
                 applicationDeployment.UpdateCompleted += new AsyncCompletedEventHandler(UpdateCompleted);
                 applicationDeployment.UpdateAsync();
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
 /// <summary>
 /// Updates the current deployment.
 /// </summary>
 /// <param name="deployment">The deployment.</param>
 /// <param name="message">The message.</param>
 /// <returns></returns>
 protected virtual bool UpdateCurrentDeployment(ApplicationDeployment deployment, ref string message)
 {
     return deployment.Update();
 }
Beispiel #15
0
 public CurrentDeployment()
 {
     deployment = ApplicationDeployment.CurrentDeployment;
 }
Beispiel #16
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();
     }
 }
Beispiel #17
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);
              }
          });
      }
        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();
            }
        }
 private void BeginUpdate()
 {
     _appDeploy = ApplicationDeployment.CurrentDeployment;
     _updateDialog.TbUpdateStage.Text = Properties.Resources.UdUpdateStageUpdating;
     _updateDialog.Title = Properties.Resources.UdUpdateStageUpdating;
     _appDeploy.UpdateCompleted -= AppDeployOnUpdateCompleted;
     _appDeploy.UpdateCompleted += AppDeployOnUpdateCompleted;
     _appDeploy.UpdateProgressChanged -= AppDeployOnUpdateProgressChanged;
     _appDeploy.UpdateProgressChanged += AppDeployOnUpdateProgressChanged;
     try
     {
         _appDeploy.UpdateAsync();
     }
     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();
     }
 }
        private static void FixTrust(ApplicationDeployment currentDeployment)
        {
            //Create the appropriate Trust settings so the Application can do
            //Click-Once Related updating
            var deploymentFullName = currentDeployment.UpdatedApplicationFullName;
            var appId = new ApplicationIdentity(deploymentFullName);
            var everything = new PermissionSet(PermissionState.Unrestricted);

            var trust = new ApplicationTrust(appId)
                            {
                                DefaultGrantSet = new PolicyStatement(everything),
                                IsApplicationTrustedToRun = true,
                                Persist = true
                            };

            ApplicationSecurityManager.UserApplicationTrusts.Add(trust);
        }
 /// <summary>
 /// Updates the add-in.
 /// </summary>
 /// <param name="currentDeployment">The current application deployment.</param>
 /// <returns></returns>
 protected override UpdateResult UpdateApplication(ApplicationDeployment currentDeployment)
 {
     FixTrust(currentDeployment);
     return base.UpdateApplication(currentDeployment);
 }
        static void Main()
        {
            // var setting = VisibilitySetting.HandleUnits;

            //                              ERROR LOGGING                                    ///

            // Add the event handler for handling UI thread exceptions to the event.
            Application.ThreadException += new ThreadExceptionEventHandler(LogUnhandledException);
            // Set the unhandled exception mode to force all Windows Forms errors to go through
            // our handler.
            Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
            // Add the event handler for handling non-UI thread exceptions to the event.
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
               //                                                                            //
            //DevExpress.UserSkins.OfficeSkins.Register();
            DevExpress.UserSkins.BonusSkins.Register();
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            try
            {
                ConnStringManager = new ConnectionStringManager.ConnectionStringManager(RegKey, PrevConnectionStringKey);
                StockoutIndexBuilder.Settings.ConnectionString = Registry.GetValue("HKEY_CURRENT_USER\\Software\\JSI\\HCMIS\\Configuration", "ConnectionString", null).ToString();
            }
            catch
            {
            }
            if (ApplicationDeployment.IsNetworkDeployed)
            {
                HCMIS = ApplicationDeployment.CurrentDeployment;
                HCMIS.CheckForUpdateCompleted += new CheckForUpdateCompletedEventHandler(HCMIS_CheckForUpdateCompleted);
                HCMIS.UpdateCompleted += new System.ComponentModel.AsyncCompletedEventHandler(HCMIS_UpdateCompleted);
            }

            // Create necessary database tables (if they do not exist already)
            CreateDatabaseTables();

            //If the user opens the application while holding down the shift key, we want to open the configuration options before the login form.
            if (Control.ModifierKeys == Keys.Shift)
            {
                Application.Run(new LoginForm(true));
            }

            Application.Run(new LoginForm());
        }
        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;
            }
        }
Beispiel #24
0
 public frmAtualizacao(ApplicationDeployment ad)
 {
     InitializeComponent();
     this.ad = ad;
 }
Beispiel #25
0
        private void CheckForUpdateCompleted(object sender, CheckForUpdateCompletedEventArgs e)
        {
            try
            {
                Delpoyment.CheckForUpdateCompleted -= CheckForUpdateCompleted;
                Delpoyment.CheckForUpdateProgressChanged -= CheckForUpdateProgressChanged;

                if (UpdateManagerProgressEvent != null)
                {
                    UpdateManagerProgressEvent(this, "");
                }

                if (e.UpdateAvailable)
                {
                    if (!e.IsUpdateRequired)
                    {
                        if (MessageBox.Show("Обнаружено, что установленная версия программы является устаревшей. Выполнить обновление?", "Требуется обновление", MessageBoxButton.OKCancel, MessageBoxImage.Information, MessageBoxResult.Cancel) == MessageBoxResult.OK)
                        {
                            BeginUpdate();
                        }
                    }
                    else
                    {
                        MessageBox.Show("Доступно обязательное обновоение для вашего приложения. Обновление будет выполнено автоматически, после чего приложение необходимо будет перезагрузить.", "Требуется обновление", MessageBoxButton.OK, MessageBoxImage.Exclamation, MessageBoxResult.OK);
                        BeginUpdate();
                    }
                }
                else
                {
                    Delpoyment = null;
                    //UpdateTimer.Start();
                }                
            }
            catch (Exception exception)
            {
                if (UpdateManagerProgressEvent != null)
                {
                    UpdateManagerProgressEvent(this, "");
                }
            }            
        }
Beispiel #26
0
        private void UpdateCompleted(object sender, AsyncCompletedEventArgs e)
        {
            try
            {
                Delpoyment.UpdateCompleted -= UpdateCompleted;
                Delpoyment.UpdateProgressChanged -= UpdateProgressChanged;

                if (UpdateManagerProgressEvent != null)
                {
                    UpdateManagerProgressEvent(this, "");
                }

                if (e.Error != null || e.Cancelled)
                {
                    Delpoyment = null;
                    //UpdateTimer.Start();
                    return;
                }

                if (MessageBox.Show("Приложение было обновлено, необходимо перезагрузить приложение для вступления изменений в силу. Выполнить перезагрузку сейчас?", "Перезагрука приложения", MessageBoxButton.OKCancel, MessageBoxImage.Information, MessageBoxResult.Cancel) == MessageBoxResult.OK)
                {
                    Core.Instance.Shutdown();
                }
                else
                {
                    Delpoyment = null;
                    //UpdateTimer.Start();
                }
            }
            catch (Exception exception)
            {
                if (UpdateManagerProgressEvent != null)
                {
                    UpdateManagerProgressEvent(this, "");
                }
            }
        }
        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
        }
Beispiel #28
0
        void MainWindow_ContentRendered(object sender, EventArgs e)
        {
            //overlay = new WindowsFormsHostOverlay(SceneViewFormContainer, sceneViewGameControl);

            //this.DataContext = new ButtonVisibilityViewModel(this);

            //System.Windows.Controls.Canvas.SetZIndex(overlay, 1);

            if (projectPathToLoad != string.Empty)
            {
                EditorCommands.LoadProject(projectPathToLoad);
                projectPathToLoad = string.Empty;
            }

            AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);

            timer = new System.Windows.Forms.Timer();
            timer.Interval = 1;
            timer.Tick += timer_Tick;
            timer.Enabled = true;

            timerUI = new System.Windows.Forms.Timer();
            timerUI.Interval = 100;
            timerUI.Tick += timerUI_Tick;
            timerUI.Enabled = true;

            EditorHandler.TilesetBrushControl = TilesetControl;

            //propertyGrid.SelectedObject = new Gibbo.Library.AnimatedSprite();

            if (ApplicationDeployment.IsNetworkDeployed)
            {
                deployment = ApplicationDeployment.CurrentDeployment;
                versionInfo = deployment.CurrentVersion.ToString();
            }

            gameViewContextMenu = new System.Windows.Controls.ContextMenu();

            GibboMenuItem panelCreateObjectItem = EditorUtils.CreateMenuItem("Create New Object...", (ImageSource)FindResource("GameObjectIcon_Sprite"));
            GibboMenuItem panelAddFromStateItem = EditorUtils.CreateMenuItem("Add From State...", null);
            GibboMenuItem panelPasteItem = EditorUtils.CreateMenuItem("Paste", (ImageSource)FindResource("PasteIcon"));

            gameViewContextMenu.Items.Add(panelCreateObjectItem);
            gameViewContextMenu.Items.Add(new System.Windows.Controls.Separator());
            gameViewContextMenu.Items.Add(panelAddFromStateItem);
            gameViewContextMenu.Items.Add(new System.Windows.Controls.Separator());
            gameViewContextMenu.Items.Add(panelPasteItem);

            SceneViewFormContainer.ContextMenu = gameViewContextMenu;

            panelCreateObjectItem.Click += createObjectItem_Click;
            panelAddFromStateItem.Click += addFromStateItem_Click;
            panelPasteItem.Click += panelPasteItem_Click;
        }