public void Add(IStatusItem item) { var si = new StatusBarItem(item); _items.Add(si); _shell.StatusStrip.Items.Add(si.Label); }
/// <summary> /// Wires the current status message. /// </summary> /// <param name="currentItem">The current item.</param> private void WireMessage(IStatusItem currentItem) { if (currentItem != null) { _currentStatusItem = currentItem; _currentStatusItem.PropertyChanged += HandleStatusItemPropertyChanged; EnsureStatusItemValues(_currentStatusItem); } }
/// <summary> /// Ensures that the correct status message is set. /// </summary> private void EnsureStatusMessage(bool respectAutoHide) { UnwireMessage(); if ((respectAutoHide) && (_currentStatusItem != null) && (_currentStatusItem.IsAutoHide)) { DequeueStatusItem(_currentStatusItem); } if (_statusItems.Count > 0) { IStatusItem currentItem = _statusItems[_statusItems.Count - 1]; WireMessage(currentItem); } }
public StatusBarItem(IStatusItem item) { Item = item; item.TextChanged += TextChanged; Label = new ToolStripStatusLabel { Text = item.Text ?? "", BorderSides = item.HasBorder ? ToolStripStatusLabelBorderSides.All : ToolStripStatusLabelBorderSides.None, AutoSize = item.Width <= 0, Spring = item.Width <= 0, TextAlign = item.Width <= 0 ? ContentAlignment.MiddleLeft : ContentAlignment.MiddleCenter, Width = Math.Max(1, item.Width) }; }
/// <summary> /// Dequeues the status item. /// </summary> /// <param name="itemId">The item id.</param> public void DequeueStatusItem(string itemId) { for (int i = _statusItems.Count - 1; i >= 0; i--) { IStatusItem statusItem = _statusItems[i]; if (statusItem.Id == itemId) { statusItem.IsActive = false; _statusItems.Remove(statusItem); EnsureStatusMessage(false); } } OnPropertyChanged(new PropertyChangedEventArgs(string.Empty)); }
/// <summary> /// Ensures that the current status item values are applied to the service properties. /// </summary> /// <param name="item">The current status item.</param> private void EnsureStatusItemValues(IStatusItem item) { if (item != null) { CurrentStatusText = item.Message; IsProgressIndeterminate = item.IsProgressIndeterminate; ProgressPercentComplete = item.ProgressPercentComplete; IsProgressing = item.IsProgressing; } else { CurrentStatusText = string.Empty; IsProgressIndeterminate = false; ProgressPercentComplete = 0; _isProgressing = false; } }
public void Connect() { IStatusItem statusItem = null; try { var args = new LoginDataEventArgs { LoginData = LoginData }; OnRequestLoginData(args); // If the request was canceled we will also cancel are connect attempt if (!args.Cancel) { statusItem = StatusService.EnqueueStatusItem("AutoConnectMessage"); statusItem.IsProgressing = true; statusItem.IsProgressIndeterminate = true; statusItem.Message = string.Format("Connecting to project {0} on server {1}.", LoginData.TeamProjectName, LoginData.TeamProjectCollectionUri); TeamProjectCollection = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(LoginData.TeamProjectCollectionUri, new UICredentialsProvider()); TeamProjectCollection.EnsureAuthenticated(); var workItemStore = TeamProjectCollection.GetService <WorkItemStore>(); TeamProject = workItemStore.Projects[LoginData.TeamProjectName]; InitReportingServiceProxy(); OnConnected(); } } catch (Exception ex) { Logger.LogException(ex); OnConnectionFailed(ex.Message); } finally { if (statusItem != null) { StatusService.DequeueStatusItem(statusItem); } FlushWindowsMessageQueue(false); } }
public ConsoleTransferProgress(IStatusItem status) { _status = status; _action = status.State.Action; }
public ConsoleTransferProgress(IStatusItem status) { _status = status; _action = status.State.Action; }
/// <summary> /// Enqueues the status item. /// </summary> /// <param name="item">The item .</param> public void EnqueueStatusItem(IStatusItem item) { _statusItems.Add(item); EnsureStatusMessage(true); OnPropertyChanged(new PropertyChangedEventArgs(string.Empty)); }