Exemplo n.º 1
0
        protected override void OnInitialize(AsyncStatus status)
        {
            // This is a default column which already exists when the control is created.
            NameColumn = Columns[0];
            NameColumn.Title = "Name";
            NameColumn.SetWidth(150);

            TaskIdColumn = new MmcListViewColumn("Task ID", -1);
            StartColumn = new MmcListViewColumn("Start Time", -1);
            EndColumn = new MmcListViewColumn("End Time", -1);
            DurationColumn = new MmcListViewColumn("Duration", -1);
            CompletedColumn = new MmcListViewColumn("Completed", -1);

            Columns.AddRange(new MmcListViewColumn[] { TaskIdColumn, StartColumn, EndColumn,
                DurationColumn, CompletedColumn });

            Refresh();

            MMC.Action RefreshAction = new MMC.Action("Refresh",
                "Refresh the Task List", SnapInShared.Refresh, "Refresh");
            ActionsPaneItems.Add(RefreshAction);

            Mode = MmcListViewMode.Report;

            InitializeWatchers();

            base.OnInitialize(status);
        }
 internal MmcListViewColumnCollection(MmcListView listView) : base(typeof(MmcListViewColumn))
 {
     this._itemsById = new Hashtable();
     if (listView == null)
     {
         throw new ArgumentNullException("listView");
     }
     this._listView = listView;
     MmcListViewColumn column = new MmcListViewColumn(Microsoft.ManagementConsole.Internal.Utility.Resources.GetString(Microsoft.ManagementConsole.Internal.Strings.MicrosoftManagementConsoleFxColumnDefaultTitle, CultureInfo.CurrentUICulture), -1, MmcListViewColumnFormat.Left, true);
     column.ListView = this._listView;
     column.Changed += new MmcListViewColumn.ColumnChangedEventHandler(this.ItemChanged);
     this._itemsById[column.Id] = column;
     base.InnerList.Add(column);
 }
 public void Clear()
 {
     if (base.Count > 1)
     {
         MmcListViewColumn[] items = new MmcListViewColumn[base.Count - 1];
         for (int i = 1; i < base.Count; i++)
         {
             items[i - 1] = this[i];
         }
         base.InnerList.RemoveRange(1, base.Count - 1);
         try
         {
             this.OnItemsRemoved(1, items);
         }
         catch
         {
             foreach (MmcListViewColumn column in items)
             {
                 base.InnerList.Add(column);
             }
             throw;
         }
     }
 }
 public void Insert(int index, MmcListViewColumn column)
 {
     base.Insert(index, column);
 }
 public int IndexOf(MmcListViewColumn column)
 {
     return base.List.IndexOf(column);
 }
 public void CopyTo(MmcListViewColumn[] array, int index)
 {
     this.CopyTo(array, index);
 }
 public bool Contains(MmcListViewColumn column)
 {
     return base.List.Contains(column);
 }
 public void AddRange(MmcListViewColumn[] columns)
 {
     base.AddRange(columns);
 }
Exemplo n.º 9
0
 private void SynchronizeColumns(MmcListViewColumn[] items, int index, ColumnCollectionChangeType changeType)
 {
     if (items == null)
     {
         throw new ArgumentNullException("items");
     }
     ISnapInPlatform snapInPlatform = base.SnapIn.SnapInPlatform;
     if (snapInPlatform == null)
     {
         throw Microsoft.ManagementConsole.Internal.Utility.CreateClassNotInitializedException("MmcListView", "SynchronizeColumns");
     }
     if (items.Length < 1)
     {
         TraceSources.ExecutiveSource.TraceEvent(TraceEventType.Verbose, 12, "Empty column update for view {0}.", new object[] { base.ViewInstanceId });
     }
     else
     {
         UpdateColumnsCommand command = new UpdateColumnsCommand();
         command.ViewInstanceId = base.ViewInstanceId;
         command.ChangeType = changeType;
         command.Index = index;
         ColumnData[] data = new ColumnData[items.Length];
         for (int i = 0; i < items.Length; i++)
         {
             data[i] = items[i].Data;
         }
         command.SetData(data);
         snapInPlatform.ProcessCommand(command);
     }
 }
Exemplo n.º 10
0
 public void Remove(MmcListViewColumn column)
 {
     base.List.Remove(column);
 }
Exemplo n.º 11
0
 protected override void OnItemsRemoved(int index, object[] items)
 {
     if (index == 0)
     {
         throw new ArgumentException(Microsoft.ManagementConsole.Internal.Utility.LoadResourceString(Microsoft.ManagementConsole.Internal.Strings.ColumnCollectionOnItemsRemovedFirstColumn), "index");
     }
     if ((this._listView != null) && (this._listView.ResultNodes.Count != 0))
     {
         throw new InvalidOperationException(Microsoft.ManagementConsole.Internal.Utility.LoadResourceString(Microsoft.ManagementConsole.Internal.Strings.ColumnCollectionOnItemsRemovedResultNode));
     }
     foreach (MmcListViewColumn column in items)
     {
         column.Changed -= new MmcListViewColumn.ColumnChangedEventHandler(this.ItemChanged);
         column.ListView = null;
         this._itemsById.Remove(column.Id);
     }
     MmcListViewColumn[] destinationArray = new MmcListViewColumn[items.Length];
     Array.Copy(items, destinationArray, items.Length);
     this.Notify(index, destinationArray, ColumnCollectionChangeType.Remove);
 }
Exemplo n.º 12
0
 protected override void OnItemsAdded(int index, object[] items)
 {
     if (index == 0)
     {
         throw new ArgumentException(Microsoft.ManagementConsole.Internal.Utility.LoadResourceString(Microsoft.ManagementConsole.Internal.Strings.ColumnCollectionOnItemsAddedIndexError), "index");
     }
     if ((this._listView != null) && (this._listView.ResultNodes.Count != 0))
     {
         throw new InvalidOperationException(Microsoft.ManagementConsole.Internal.Utility.LoadResourceString(Microsoft.ManagementConsole.Internal.Strings.ColumnCollectionOnItemsAddedInvalidOperationResultNode));
     }
     foreach (MmcListViewColumn column in items)
     {
         if (column == null)
         {
             throw Microsoft.ManagementConsole.Internal.Utility.CreateArgumentException("items[x]", Microsoft.ManagementConsole.Internal.Strings.ArgumentExceptionNullValue, new object[0]);
         }
         if (column.ListView != null)
         {
             throw new InvalidOperationException(Microsoft.ManagementConsole.Internal.Utility.LoadResourceString(Microsoft.ManagementConsole.Internal.Strings.ColumnCollectionOnItemsAddedInvalidOperationInsertTwice));
         }
     }
     foreach (MmcListViewColumn column2 in items)
     {
         column2.Changed += new MmcListViewColumn.ColumnChangedEventHandler(this.ItemChanged);
         column2.ListView = this._listView;
         this._itemsById[column2.Id] = column2;
     }
     MmcListViewColumn[] destinationArray = new MmcListViewColumn[items.Length];
     Array.Copy(items, destinationArray, items.Length);
     this.Notify(index, destinationArray, ColumnCollectionChangeType.Add);
 }
Exemplo n.º 13
0
 private void Notify(int index, MmcListViewColumn[] columns, ColumnCollectionChangeType action)
 {
     if (this.ItemsChanged != null)
     {
         this.ItemsChanged(this, new ColumnCollectionEventArgs(index, columns, action));
     }
 }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="status">asynchronous status to update the console</param>
        protected override void OnInitialize(AsyncStatus status)
        {
            // Create a set of columns for use in the list view
            DescriptionColumn = new MmcListViewColumn("Description ", 300);
            StatusColumn = new MmcListViewColumn("Status", -1);
            StartupType = new MmcListViewColumn("Startup Type", -1);
            LogOnAs = new MmcListViewColumn("Log On As", -1);

            Columns.AddRange(new MmcListViewColumn[] { DescriptionColumn, StatusColumn, StartupType, LogOnAs });
            Columns[0].Title = "Service ";
            Columns[0].SetWidth(200);

            // load the list with values
            Refresh();

            // Add a view Action.
            Action ViewAction = new Action("Refresh", "refresh", -1, "Refresh");
            ViewAction.Checked = true;
            ActionsPaneItems.Add(ViewAction);

            Mode = MmcListViewMode.LargeIcon;

            base.OnInitialize(status);
        }
Exemplo n.º 15
0
 public void InsertRange(int index, MmcListViewColumn[] columns)
 {
     base.InsertRange(index, columns);
 }
Exemplo n.º 16
0
 public void Add(MmcListViewColumn column)
 {
     base.List.Add(column);
 }
Exemplo n.º 17
0
 public ColumnCollectionEventArgs(int index, MmcListViewColumn[] items, ColumnCollectionChangeType changeType)
 {
     this._index = index;
     this._items = items;
     this._changeType = changeType;
 }
Exemplo n.º 18
0
 internal override void InternalInitialize()
 {
     MmcListViewDescription viewDescription = base.ViewDescription as MmcListViewDescription;
     if (viewDescription == null)
     {
         throw new InvalidOperationException(Microsoft.ManagementConsole.Internal.Utility.FormatResourceString("Microsoft.ManagementConsole.ViewDescription.InvalidViewDescription", new object[] { "MmcListView", "MmcListViewDescription" }));
     }
     this._options = viewDescription.Options;
     if (this._mode != MmcListViewMode.Report)
     {
         this.SynchronizeMode(this._mode);
     }
     if (this._columns != null)
     {
         this.SynchronizeColumns(new MmcListViewColumn[] { this._columns[0] }, 0, ColumnCollectionChangeType.Modify);
         int length = this._columns.Count - 1;
         if (length > 0)
         {
             MmcListViewColumn[] sourceArray = this._columns.ToArray();
             MmcListViewColumn[] destinationArray = new MmcListViewColumn[length];
             Array.Copy(sourceArray, 1, destinationArray, 0, length);
             this.SynchronizeColumns(destinationArray, 1, ColumnCollectionChangeType.Add);
         }
     }
     if ((this._resultNodes != null) && (this._resultNodes.Count > 0))
     {
         this.SynchronizeResultNodes(this.ResultNodes.ToArray(), 0, ResultNodeCollectionChangeType.Add);
     }
     if (this._pendingSortCommand != null)
     {
         bool descending = this._pendingSortCommand.Descending;
         int[] ids = new int[this.ResultNodes.Count];
         for (int i = 0; i < this.ResultNodes.Count; i++)
         {
             int index = descending ? ((this.ResultNodes.Count - i) - 1) : i;
             ids[index] = this.ResultNodes[i].Id;
         }
         this._pendingSortCommand.ViewInstanceId = base.ViewInstanceId;
         this._pendingSortCommand.SetIds(ids);
         base.SnapIn.SnapInPlatform.ProcessCommand(this._pendingSortCommand);
         this._pendingSortCommand = null;
     }
 }