コード例 #1
0
ファイル: DatabaseUpdateThread.cs プロジェクト: radtek/BootFX
 /// <summary>
 /// Raises the <c>CheckComplete</c> event.
 /// </summary>
 protected virtual void OnCheckComplete(DatabaseUpdateCheckResultsEventArgs e)
 {
     // raise...
     if (CheckComplete != null)
     {
         CheckComplete(this, e);
     }
 }
コード例 #2
0
ファイル: DatabaseUpdateDialog.cs プロジェクト: radtek/BootFX
        private void _thread_CheckComplete(object sender, DatabaseUpdateCheckResultsEventArgs e)
        {
            if (e == null)
            {
                throw new ArgumentNullException("e");
            }

            // flip...
            if (this.InvokeRequired)
            {
                DatabaseUpdateCheckResultsEventHandler d = new DatabaseUpdateCheckResultsEventHandler(this._thread_CheckComplete);
                this.Invoke(d, new object[] { sender, e });
                return;
            }

            // check...
            if (e.Results == null)
            {
                throw new InvalidOperationException("e.Results is null.");
            }

            // update...
            if (e.Results.IsUpToDate)
            {
                Alert.ShowInformation(this, "The database is up-to-date.");
            }
            else
            {
                string[] messages = e.Results.GetFriendlyUnitWorkMessages();
                if (messages == null)
                {
                    throw new InvalidOperationException("'messages' is null.");
                }
                if (messages.Length == 0)
                {
                    throw new InvalidOperationException("'messages' is zero-length.");
                }

                StringBuilder builder = new StringBuilder();
                builder.Append("Changes need to be made to this database:\r\n");
                for (int index = 0; index < messages.Length; index++)
                {
                    builder.Append("\r\n   - ");
                    if (index == 16)
                    {
                        builder.Append("(more...)");
                        break;
                    }
                    else
                    {
                        builder.Append(messages[index]);
                    }
                }

                // show...
                Alert.ShowWarning(this, builder.ToString());
            }
        }
コード例 #3
0
ファイル: DatabaseUpdateDialog.cs プロジェクト: radtek/BootFX
        private void worker_CheckComplete(object sender, DatabaseUpdateCheckResultsEventArgs e)
        {
            StringBuilder builder = new StringBuilder();

            if (e.Results.IsUpToDate)
            {
                builder.Append("The database is up-to-date.");
            }
            else
            {
                builder.Append("Changed need to be made to the database:\r\n");
                int index = 0;
                foreach (string message in e.Results.GetFriendlyUnitWorkMessages())
                {
                    const string prefix = "\r\n   - ";
                    builder.Append(prefix);
                    builder.Append(message);

                    // mbr - 24-07-2007 - case 321 - the new dialog lets us show loads...
//					if(index == 20)
//					{
//						builder.Append(prefix);
//						builder.Append("(more...)");
//						break;
//					}

                    // next...
                    index++;
                }
            }

            // show...
            _completedOk = true;

            // mbr - 24-07-2007 - case 321 - changed.
            //ThreadUIHelper.Current.ShowInformation(builder.ToString());
            this.ShowChangesTbd(builder.ToString());
        }