コード例 #1
0
ファイル: MainForm.cs プロジェクト: Sage/SData-Contracts
        private void Synchronize(SynchronisationDirection direction)
        {
            try
            {

                if (!PersistFormToModel())
                    return;

                // Create a new instance of the sync engine
                // and add a Logger. The Logger of type FifoStackLogger appended here
                // will provide a stack of messages that can be polled.
                Engine syncEngine = new Engine(this.toolStripRunName.Text, DateTime.Now, direction, _syncInfo);
                FifoStackLogger logger = new FifoStackLogger();
                logger.SeverityFilter = Severity.Info;
                syncEngine.Logger = logger;

                // Create and diaplay progress form that will start the syncEngine
                ProgressForm progressForm = new ProgressForm(syncEngine);
                progressForm.ShowDialog(this);
            }

            catch (Exception ex)
            {
                MessageBox.Show("An unexpected error occured: " + Environment.NewLine + ex.Message);
            }
            finally
            {
                try
                {
                    int runCounter = this.GetRunCounter();
                    runCounter++;
                    // Change the RunCounter and display new next run Name
                    this.SetRunCounter(runCounter);
                    this.toolStripRunName.Text = string.Format(RUNNAME_TEMPLATE, runCounter);
                }
                catch (Exception exception)
                {
                    MessageBox.Show("Failed to save config file: " + Environment.NewLine + exception.Message);
                }
            }
        }
コード例 #2
0
ファイル: ProgressForm.cs プロジェクト: Sage/SData-Contracts
 public ProgressForm(Engine syncEngine)
     : this()
 {
     _syncEngine = syncEngine;
 }