コード例 #1
0
        public static LinkedInstanceProperties DuplicateSelectedCategories(LinkedInstanceProperties lip, Document recipientDoc, UpdateMode updateMode)
        {
            var updatedLIP = lip;

            try
            {
                messageBuilder = new StringBuilder();
                var updateLabelDelegate = new UpdateStatusLabelDelegate(statusLabel.SetValue);

                progressBar.Visibility = System.Windows.Visibility.Visible;
                var categories = lip.Categories.Values.ToList();
                //categories = categories.OrderBy(o => o.Priority).ToList();
                foreach (var cp in categories)
                {
                    if (cp.Selected)
                    {
                        System.Windows.Threading.Dispatcher.CurrentDispatcher.Invoke(updateLabelDelegate, System.Windows.Threading.DispatcherPriority.Background, new object[] { TextBlock.TextProperty, "Copying " + cp.CategoryName + "..." });
                        updatedLIP = DuplicateElements(recipientDoc, updatedLIP, cp, updateMode);
                    }
                }
                progressBar.Visibility = System.Windows.Visibility.Hidden;
                System.Windows.Threading.Dispatcher.CurrentDispatcher.Invoke(updateLabelDelegate, System.Windows.Threading.DispatcherPriority.Background, new object[] { TextBlock.TextProperty, "Ready" });

                MessageBox.Show(messageBuilder.ToString(), "Duplicate Elements", MessageBoxButton.OK, MessageBoxImage.Information);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Failed to move elements.\n" + ex.Message, "Move Elements", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
            return(updatedLIP);
        }
コード例 #2
0
ファイル: StatusBarManager.cs プロジェクト: dickiyamu/revit
        public static void InitializeProgress(string statusText, int maximum, bool indeterminate = false)
        {
            if (null == ProgressBar || null == StatusLabel)
            {
                return;
            }

            ProgressBar.Visibility = Visibility.Visible;
            ProgressValue          = 0;

            _updateLabelDelegate = StatusLabel.SetValue;
            Dispatcher.CurrentDispatcher.Invoke(_updateLabelDelegate, DispatcherPriority.Background, TextBlock.TextProperty, statusText);

            _updatePbDelegate   = ProgressBar.SetValue;
            ProgressBar.Value   = ProgressValue;
            ProgressBar.Maximum = maximum;

            Logs = new List <string>();
            LogButton.Visibility = Visibility.Hidden;

            if (indeterminate)
            {
                ProgressBar.IsIndeterminate = true;
            }
        }
コード例 #3
0
 /// <summary>
 /// Updates the status label, if InvokeRequired is enabled, its
 /// uses an delegate call
 /// </summary>
 /// <param name="text">The text, as new service status</param>
 private void UpdateStatusLabel(string text)
 {
     if (this.InvokeRequired)
     {
         UpdateStatusLabelDelegate utvd = new UpdateStatusLabelDelegate(this.UpdateStatusLabel);
         this.Invoke(utvd, new object[] { text });
     }
     else
     {
         this.LblStatus.Text = text;
     }
 }
コード例 #4
0
 /// <summary>
 /// Updates the status label at bottom of MainForm
 /// Purpose of label is to show the last logged entry, even when not on Log tab page
 /// Implementing thread-safe access using InvokeRequired and delegates
 /// </summary>
 /// <param name="msg">Log message</param>
 public void UpdateStatusLbl(string msg)
 {
     if (this.lbl_Status.InvokeRequired)
     {
         UpdateStatusLabelDelegate degate = new UpdateStatusLabelDelegate(UpdateStatusLbl);
         this.Invoke(degate, new object[] { msg });
     }
     else
     {
         this.lbl_Status.Text = msg;
     }
 }
コード例 #5
0
ファイル: StatusBarManager.cs プロジェクト: dickiyamu/revit
        public static void SetStatus(string message)
        {
            if (StatusLabel == null)
            {
                return;
            }

            if (_updateLabelDelegate == null)
            {
                _updateLabelDelegate = StatusLabel.SetValue;
            }

            Dispatcher.CurrentDispatcher.Invoke(_updateLabelDelegate, DispatcherPriority.Background, TextBlock.TextProperty, message);
        }
コード例 #6
0
        /// <summary>
        /// Reset the value
        /// </summary>
        /// <param name="statusText"></param>
        /// <param name="maximum"></param>
        public static void InitializeProgress(string statusText, int maximum)
        {
            if (null != progressBar && null != statusLabel)
            {
                progressBar.Visibility = System.Windows.Visibility.Visible;
                progressValue          = 0;

                updateLabelDelegate = new UpdateStatusLabelDelegate(statusLabel.SetValue);
                System.Windows.Threading.Dispatcher.CurrentDispatcher.Invoke(updateLabelDelegate, System.Windows.Threading.DispatcherPriority.Background, new object[] { TextBlock.TextProperty, statusText });

                updatePbDelegate    = new UpdateProgressBarDelegate(progressBar.SetValue);
                progressBar.Value   = progressValue;
                progressBar.Maximum = maximum;
            }
        }
コード例 #7
0
ファイル: StatusBarManager.cs プロジェクト: karthi1015/Zombie
        /// <summary>
        /// Initialize Progress Bar and set Status Label.
        /// </summary>
        /// <param name="statusText">Status Label initial value.</param>
        /// <param name="maximum">Max count for the Progress Bar.</param>
        public static void InitializeProgress(string statusText, int maximum)
        {
            if (null == ProgressBar || null == StatusLabel)
            {
                return;
            }

            ProgressBar.Visibility = Visibility.Visible;
            ProgressValue          = 0;

            _updateLabelDelegate = StatusLabel.SetValue;
            Dispatcher.CurrentDispatcher.Invoke(_updateLabelDelegate, DispatcherPriority.Background, TextBlock.TextProperty, statusText);

            _updatePbDelegate   = ProgressBar.SetValue;
            ProgressBar.Value   = ProgressValue;
            ProgressBar.Maximum = maximum;
        }
コード例 #8
0
		/// <summary>
		/// Updates the status label, if InvokeRequired is enabled, its
		/// uses an delegate call
		/// </summary>
		/// <param name="text">The text, as new service status</param>
		private void UpdateStatusLabel(string text)
		{
			if (this.InvokeRequired)
			{
				UpdateStatusLabelDelegate utvd = new UpdateStatusLabelDelegate(this.UpdateStatusLabel);
				this.Invoke(utvd, new object[] { text });
			}
			else
			{
				this.LblStatus.Text = text;
			}
		}