예제 #1
0
        private void UpdateButton_Click(object sender, RoutedEventArgs e)
        {
            this.UpdateButton.IsEnabled = false;
            Task download = new Task(delegate()
            {
                try
                {
                    XTMFUpdateController controller = new XTMFUpdateController();
                    this.Dispatcher.Invoke(new Action(delegate()
                    {
                        try
                        {
                            controller.XTMFDirectory            = Directory.GetCurrentDirectory();
                            controller.XTMFUpdateServerPort     = int.Parse(this.PortBox.Text);
                            controller.XTMFUpdateServerLocation = this.ServerAddressBox.Text;
                        }
                        catch
                        {
                        }
                    }));
                    offset = 0;
                    scale  = 0.5f;
                    controller.UpdateCore(Update);
                    offset = 50;
                    controller.UpdateModules(Update);
                    MessageBox.Show("Update Complete!");
                    this.Dispatcher.Invoke(new Action(delegate() { this.Close(); }));
                }
                catch (AggregateException error)
                {
                    if (error.InnerException == null)
                    {
                        MessageBox.Show(error.Message);
                    }
                    else
                    {
                        MessageBox.Show(error.InnerException.Message);
                    }
                }
                catch (Exception error)
                {
                    MessageBox.Show(error.Message);
                }
                this.Dispatcher.Invoke(new Action(delegate() { this.UpdateButton.IsEnabled = true; }));
            });

            try
            {
                download.Start();
            }
            catch (Exception error)
            {
                MessageBox.Show(error.Message);
            }
        }
예제 #2
0
 private void UpdateButton_Click(object sender, RoutedEventArgs e)
 {
     this.UpdateButton.IsEnabled = false;
     Task download = new Task( delegate()
         {
             try
             {
                 XTMFUpdateController controller = new XTMFUpdateController();
                 this.Dispatcher.Invoke( new Action( delegate()
                     {
                         try
                         {
                             controller.XTMFDirectory = Directory.GetCurrentDirectory();
                             controller.XTMFUpdateServerPort = int.Parse( this.PortBox.Text );
                             controller.XTMFUpdateServerLocation = this.ServerAddressBox.Text;
                         }
                         catch
                         {
                         }
                     } ) );
                 offset = 0;
                 scale = 0.5f;
                 controller.UpdateCore( Update );
                 offset = 50;
                 controller.UpdateModules( Update );
                 MessageBox.Show( "Update Complete!" );
                 this.Dispatcher.Invoke( new Action( delegate() { this.Close(); } ) );
             }
             catch ( AggregateException error )
             {
                 if ( error.InnerException == null )
                 {
                     MessageBox.Show( error.Message );
                 }
                 else
                 {
                     MessageBox.Show( error.InnerException.Message );
                 }
             }
             catch ( Exception error )
             {
                 MessageBox.Show( error.Message );
             }
             this.Dispatcher.Invoke( new Action( delegate() { this.UpdateButton.IsEnabled = true; } ) );
         } );
     try
     {
         download.Start();
     }
     catch ( Exception error )
     {
         MessageBox.Show( error.Message );
     }
 }