Пример #1
0
        public void ListViewGroupCollection_Clear_Empty_Success()
        {
            using var listView = new ListView();
            ListViewGroupCollection collection = listView.Groups;

            collection.Clear();
            Assert.Empty(collection);
        }
Пример #2
0
        public void ListViewGroupCollection_Clear_Invoke_Success()
        {
            using var listView = new ListView();
            ListViewGroupCollection collection = listView.Groups;
            var group = new ListViewGroup();

            collection.Add(group);

            collection.Clear();
            Assert.Empty(collection);
            Assert.Null(group.ListView);

            // Clear again.
            collection.Clear();
            Assert.Empty(collection);
            Assert.Null(group.ListView);
        }
Пример #3
0
        public void ListViewGroupCollection_Clear_InvokeListViewHasHandle_Success()
        {
            using var listView = new ListView();
            Assert.NotEqual(IntPtr.Zero, listView.Handle);

            ListViewGroupCollection collection = listView.Groups;
            var group = new ListViewGroup();

            collection.Add(group);

            collection.Clear();
            Assert.Empty(collection);
            Assert.Null(group.ListView);

            // Clear again.
            collection.Clear();
            Assert.Empty(collection);
            Assert.Null(group.ListView);
        }
        //[InjectionProperty(Required = false)]
        //private ITraceWindowSource TraceSource
        //{
        //  set { _traceSource = value; }
        //}

        #endregion

        public MainForm()
            : base(true)
        {
            InitializeComponent();

            //this.SetLogoIcon();
            this.SetLogoImages(picTop, status);
            UpdateCaption();

            tslblStatusState.SetLogoForeColor();
            tslblStatusNetwork.SetLogoForeColor();

            imgServices.Images.Add(Images.OK);
            imgServices.Images.Add(Images.Error);
            imgServices.Images.Add(Images.Extension);
            imgServices.Images.Add(Images.Extension.MakeGrayscale());
            imgServices.Images.Add(Images.Find);
            imgServices.Images.Add(Images.Warning);

            lblExtensionsWarning.ImageIndex = ImageIndexWarning;
            lblMonitorWarning.ImageIndex    = ImageIndexWarning;

            ListViewGroupCollection lvgc = lvwMonitor.Groups;

            lvgc.Clear();
            foreach (MonitoringObjectCategory mt in RuntimeHelper.GetEnumElements <MonitoringObjectCategory>())
            {
                lvgc.Add(mt.ToString(), mt.GetString());
            }

            _gazprom                = null;
            _settingsForm           = null;
            _aboutForm              = null;
            _inputForm              = new InputForm();
            _stateTimer             = new ToolStripStateTimer(tslblStatusState, TimeSpan.FromSeconds(2));
            _stateTimer.DefaultText = StatusStateReady;
            _stateTimer.UpdateStateText();

            _chordHandler = new ChordKeyHandler(this);
            _actions      = new Dictionary <int, HotKeyAction>();
            _actions.Add(_chordHandler.AddChord(Keys.Control, Keys.L, Keys.F), HotKeyAction.OpenLogFolder);
            _actions.Add(_chordHandler.AddChord(Keys.Control, Keys.L, Keys.D), HotKeyAction.DeleteLogFiles);
            _actions.Add(_chordHandler.AddChord(Keys.Control, Keys.L, Keys.O), HotKeyAction.OpenLogFile);
            _actions.Add(_chordHandler.AddChord(Keys.Control, Keys.L, Keys.W), HotKeyAction.LogComment);
            _actions.Add(_chordHandler.AddChord(Keys.Control, Keys.L, Keys.R), HotKeyAction.LogRuntimeInfo);
            _actions.Add(_chordHandler.AddChord(Keys.Control, Keys.D, Keys.N), HotKeyAction.NetworkControl);
            _actions.Add(_chordHandler.AddChord(Keys.Control, Keys.S, Keys.E), HotKeyAction.ShowExtensionFilter);
            _actions.Add(_chordHandler.AddChord(Keys.Control, Keys.L, Keys.C), HotKeyAction.LogControl);
            _chordHandler.ChordPressed += OnChordPressed;

            _menuMain = null;
            //_traceSource = null;
        }
        public void ClearTest()
        {
            ListViewGroup group1 = new ListViewGroup("Item1");
            ListViewGroup group2 = new ListViewGroup("Item2");

            grpCol.Add(group1);
            grpCol.Add(group2);
            grpCol.Clear();

            Assert.AreEqual(0, grpCol.Count, "#C1");
            Assert.AreEqual(null, group1.ListView, "#C2");
            Assert.AreEqual(null, group2.ListView, "#C3");
        }