Exemple #1
0
        public ActivityMonitorComponentControl(ActivityMonitorComponent component)
            : base(component)
        {
            _component = component;
            InitializeComponent();

            ToolStripBuilder.BuildToolStrip(ToolStripBuilder.ToolStripKind.Toolbar, _workItemToolStrip.Items, _component.WorkItemActions.ChildNodes);

            this.DataBindings.Add("IsConnected", _component, "IsConnected");

            _aeTitle.DataBindings.Add("Text", _component, "AeTitle");
            this.DataBindings.Add("HostName", _component, "HostName");

            _totalStudies.DataBindings.Add("Text", _component, "TotalStudies");
            _failures.DataBindings.Add("Text", _component, "Failures");

            _diskSpace.DataBindings.Add("Text", _component, "DiskspaceUsed");
            _diskSpaceMeter.DataBindings.Add("Value", _component, "DiskspaceUsedPercent");
            Binding diskSpaceMeterFillStateBinding = new Binding("FillState", _component, "IsMaximumDiskspaceUsageExceeded", true, DataSourceUpdateMode.OnPropertyChanged);

            diskSpaceMeterFillStateBinding.Parse  += ParseMeterFillState;
            diskSpaceMeterFillStateBinding.Format += FormatMeterFillState;
            _diskSpaceMeter.DataBindings.Add(diskSpaceMeterFillStateBinding);

            _diskSpaceWarningIcon.DataBindings.Add("Visible", _component, "IsMaximumDiskspaceUsageExceeded", true, DataSourceUpdateMode.OnPropertyChanged);
            _diskSpaceWarningMessage.DataBindings.Add("Visible", _component, "IsMaximumDiskspaceUsageExceeded", true, DataSourceUpdateMode.OnPropertyChanged);
            _diskSpaceWarningMessage.DataBindings.Add("Text", _component, "DiskSpaceWarningMessage", true, DataSourceUpdateMode.OnPropertyChanged);

            // need to work with these manually, because data-binding doesn't work well with toolstrip comboboxes
            _activityFilter.Items.AddRange(_component.ActivityTypeFilterChoices.Cast <object>().Select(i => new FilterItem(i, _component.FormatActivityTypeFilter)).ToArray());
            _activityFilter.SelectedIndex         = 0;
            _activityFilter.SelectedIndexChanged += _activityFilter_SelectedIndexChanged;

            // need to work with these manually, because data-binding doesn't work well with toolstrip comboboxes
            _statusFilter.Items.AddRange(_component.StatusFilterChoices.Cast <object>().Select(i => new FilterItem(i, _component.FormatStatusFilter)).ToArray());
            _statusFilter.SelectedIndex         = 0;
            _statusFilter.SelectedIndexChanged += _statusFilter_SelectedIndexChanged;

            // need to work with these manually, because data-binding doesn't work well with toolstrip comboboxes
            _textFilter.TextChanged += _textFilter_TextChanged;

            _component.PropertyChanged += _component_PropertyChanged;

            _workItemsTableView.Table     = _component.WorkItemTable;
            _workItemsTableView.MenuModel = _component.WorkItemActions;
            _workItemsTableView.DataBindings.Add("Selection", _component, "WorkItemSelection", true, DataSourceUpdateMode.OnPropertyChanged);

            // suppress keeping the selection in view, otherwise it can be totally unusable when there's lot's of activity
            _workItemsTableView.SuppressForceSelectionDisplay = true;

            UpdateTooltips();

            // only show study rules link if this feature is actually available
            _studyRulesLink.DataBindings.Add("Visible", _component, "StudyManagementRulesLinkVisible");
        }
		public ActivityMonitorComponentControl(ActivityMonitorComponent component)
			: base(component)
		{
			_component = component;
			InitializeComponent();

			ToolStripBuilder.BuildToolStrip(ToolStripBuilder.ToolStripKind.Toolbar, _workItemToolStrip.Items, _component.WorkItemActions.ChildNodes);

			this.DataBindings.Add("IsConnected", _component, "IsConnected");

			_aeTitle.DataBindings.Add("Text", _component, "AeTitle");
			this.DataBindings.Add("HostName", _component, "HostName");
			
			_totalStudies.DataBindings.Add("Text", _component, "TotalStudies");
			_failures.DataBindings.Add("Text", _component, "Failures");

			_diskSpace.DataBindings.Add("Text", _component, "DiskspaceUsed");
			_diskSpaceMeter.DataBindings.Add("Value", _component, "DiskspaceUsedPercent");
            Binding diskSpaceMeterFillStateBinding = new Binding("FillState", _component, "IsMaximumDiskspaceUsageExceeded", true, DataSourceUpdateMode.OnPropertyChanged);
            diskSpaceMeterFillStateBinding.Parse += ParseMeterFillState;
            diskSpaceMeterFillStateBinding.Format += FormatMeterFillState;
		    _diskSpaceMeter.DataBindings.Add(diskSpaceMeterFillStateBinding);

            _diskSpaceWarningIcon.DataBindings.Add("Visible", _component, "IsMaximumDiskspaceUsageExceeded", true, DataSourceUpdateMode.OnPropertyChanged);
            _diskSpaceWarningMessage.DataBindings.Add("Visible", _component, "IsMaximumDiskspaceUsageExceeded", true, DataSourceUpdateMode.OnPropertyChanged);
            _diskSpaceWarningMessage.DataBindings.Add("Text", _component, "DiskSpaceWarningMessage", true, DataSourceUpdateMode.OnPropertyChanged);

			// need to work with these manually, because data-binding doesn't work well with toolstrip comboboxes
			_activityFilter.Items.AddRange(_component.ActivityTypeFilterChoices.Cast<object>().Select(i => new FilterItem(i, _component.FormatActivityTypeFilter)).ToArray());
			_activityFilter.SelectedIndex = 0;
			_activityFilter.SelectedIndexChanged += _activityFilter_SelectedIndexChanged;

			// need to work with these manually, because data-binding doesn't work well with toolstrip comboboxes
			_statusFilter.Items.AddRange(_component.StatusFilterChoices.Cast<object>().Select(i => new FilterItem(i, _component.FormatStatusFilter)).ToArray());
			_statusFilter.SelectedIndex = 0;
			_statusFilter.SelectedIndexChanged += _statusFilter_SelectedIndexChanged;

			// need to work with these manually, because data-binding doesn't work well with toolstrip comboboxes
			_textFilter.TextChanged += _textFilter_TextChanged;

			_component.PropertyChanged += _component_PropertyChanged;

			_workItemsTableView.Table = _component.WorkItemTable;
			_workItemsTableView.MenuModel = _component.WorkItemActions;
			_workItemsTableView.DataBindings.Add("Selection", _component, "WorkItemSelection", true, DataSourceUpdateMode.OnPropertyChanged);

			// suppress keeping the selection in view, otherwise it can be totally unusable when there's lot's of activity
			_workItemsTableView.SuppressForceSelectionDisplay = true;

			UpdateTooltips();

			// only show study rules link if this feature is actually available
			_studyRulesLink.DataBindings.Add("Visible", _component, "StudyManagementRulesLinkVisible");
		}
        public static void Show(IDesktopWindow desktopWindow)
        {
            if (_workspace != null)
            {
                _workspace.Activate();
                return;
            }

            if (!PermissionsHelper.IsInRole(AuthorityTokens.ActivityMonitor.View))
            {
                desktopWindow.ShowMessageBox(SR.WarningActivityMonitorPermission, MessageBoxActions.Ok);
                return;
            }

            var component = new ActivityMonitorComponent();
            _workspace = ApplicationComponent.LaunchAsWorkspace(desktopWindow, component, SR.TitleActivityMonitor);
            _workspace.Closed += ((sender, args) =>
            {
                _workspace = null;
            });
        }
		public void SetComponent(IApplicationComponent component)
		{
			_component = (ActivityMonitorComponent)component;
		}
 public void SetComponent(IApplicationComponent component)
 {
     _component = (ActivityMonitorComponent)component;
 }