Ejemplo n.º 1
0
 public override ListViewItem GetMenuItem(ListViewGroupCollection groups)
 {
     System.Windows.Forms.ListViewItem listViewItem2 = new System.Windows.Forms.ListViewItem("年班管理", 5);
     listViewItem2.Group = groups.Cast <ListViewGroup>()
                           .Where(l => l.Name.Equals("lvgSchool")).FirstOrDefault();
     listViewItem2.ToolTipText = "年班管理";
     return(listViewItem2);
 }
        public void ListViewGroupCollection_Contains_Empty_ReturnsFalse()
        {
            var listView = new ListView();
            ListViewGroupCollection collection = listView.Groups;

            Assert.False(collection.Contains(new ListViewGroup()));
            Assert.False(collection.Contains(null));
        }
        public void ListViewGroupCollection_AddRange_NullGroups_ThrowsArgumentNullException()
        {
            var listView = new ListView();
            ListViewGroupCollection collection = listView.Groups;

            Assert.Throws <ArgumentNullException>("groups", () => collection.AddRange((ListViewGroup[])null));
            Assert.Throws <ArgumentNullException>("groups", () => collection.AddRange((ListViewGroupCollection)null));
        }
        public void ListViewGroupCollection_Clear_Empty_Success()
        {
            var listView = new ListView();
            ListViewGroupCollection collection = listView.Groups;

            collection.Clear();
            Assert.Empty(collection);
        }
        public void ListViewGroupCollection_Item_SetStringEmptyCollection_Nop()
        {
            var listView = new ListView();
            ListViewGroupCollection collection = listView.Groups;

            collection["text"] = new ListViewGroup();
            Assert.Empty(collection);
        }
        public void ListViewGroupCollection_Item_GetInvalidIndex_ThrowsArgumentOutOfRangeException(int index)
        {
            var listView = new ListView();
            ListViewGroupCollection collection = listView.Groups;

            collection.Add(new ListViewGroup());
            Assert.Throws <ArgumentOutOfRangeException>("index", () => collection[index]);
        }
Ejemplo n.º 7
0
 public override ListViewItem GetMenuItem(ListViewGroupCollection groups)
 {
     System.Windows.Forms.ListViewItem listViewItem9 = new System.Windows.Forms.ListViewItem("修改密码", 3);
     listViewItem9.Group = groups.Cast <ListViewGroup>()
                           .Where(l => l.Name.Equals("lvgManage")).FirstOrDefault();
     listViewItem9.ToolTipText = "修改密码";
     return(listViewItem9);
 }
        public void ListViewGroupCollection_Item_SetNull_ThrowsArgumentNullException()
        {
            var listView = new ListView();
            ListViewGroupCollection collection = listView.Groups;

            collection.Add(new ListViewGroup());
            Assert.Throws <ArgumentNullException>("value", () => collection[0] = null);
        }
Ejemplo n.º 9
0
        public void ListViewGroupCollection_Insert_NullGroup_ThrowsArgumentNullException(int index)
        {
            var listView = new ListView();
            ListViewGroupCollection collection = listView.Groups;

            collection.Add(new ListViewGroup());
            Assert.Throws <ArgumentNullException>("group", () => collection.Insert(index, null));
        }
Ejemplo n.º 10
0
        public void ListViewGroupCollection_IndexOf_Empty_ReturnsFalse()
        {
            var listView = new ListView();
            ListViewGroupCollection collection = listView.Groups;

            Assert.Equal(-1, collection.IndexOf(new ListViewGroup()));
            Assert.Equal(-1, collection.IndexOf(null));
        }
Ejemplo n.º 11
0
        public void ListViewGroupCollection_AddRange_NullValueInGroups_ThrowsArgumentNullException()
        {
            using var listView = new ListView();
            ListViewGroupCollection collection = listView.Groups;
            var group = new ListViewGroup();

            Assert.Throws <ArgumentNullException>("group", () => collection.AddRange(new ListViewGroup[] { group, null }));
            Assert.Same(group, Assert.Single(collection.Cast <ListViewGroup>()));
        }
Ejemplo n.º 12
0
        public override ListViewItem GetMenuItem(ListViewGroupCollection groups)
        {
            var listViewItem1 = new System.Windows.Forms.ListViewItem("基本信息", 4);

            listViewItem1.Group = groups.Cast <ListViewGroup>()
                                  .Where(l => l.Name.Equals("lvgSchool")).FirstOrDefault();
            listViewItem1.ToolTipText = "基本信息";
            return(listViewItem1);
        }
Ejemplo n.º 13
0
        public void ListViewGroupCollection_CopyTo_Empty_Nop()
        {
            using var listView = new ListView();
            ListViewGroupCollection collection = listView.Groups;
            var array = new object[] { 1, 2, 3 };

            collection.CopyTo(array, 0);
            Assert.Equal(new object[] { 1, 2, 3 }, array);
        }
Ejemplo n.º 14
0
        public override ListViewItem GetMenuItem(ListViewGroupCollection groups)
        {
            var listViewItem5 = new System.Windows.Forms.ListViewItem("卡片机管理", 8);

            listViewItem5.Group = groups.Cast <ListViewGroup>()
                                  .Where(l => l.Name.Equals("lvgManage")).FirstOrDefault();
            listViewItem5.ToolTipText = "卡片机管理";
            return(listViewItem5);
        }
        public void ListViewGroupCollection_Add_ListViewGroup_Success()
        {
            var listView = new ListView();
            ListViewGroupCollection collection = listView.Groups;
            var group = new ListViewGroup();

            collection.Add(group);
            Assert.Same(group, Assert.Single(collection));
            Assert.Same(listView, group.ListView);
        }
Ejemplo n.º 16
0
        public void ListViewGroupCollection_Item_GetValidIndex_ReturnsExpected()
        {
            using var listView = new ListView();
            ListViewGroupCollection collection = listView.Groups;

            var group = new ListViewGroup();

            collection.Add(group);
            Assert.Same(group, collection[0]);
        }
Ejemplo n.º 17
0
 //public static string ToStringforPrintingDetails(this OnlineOrder order)
 //{
 //    var delivery = order.Delivery == Sharing.Core.DeliveryTypes.Takeout ? "外送" : "自取";
 //    var address = order.Delivery == Sharing.Core.DeliveryTypes.BySelf ? "店内" : order.Address;
 //    return string.Concat(
 //        $"单号:{order.Code}\r\n",
 //        $"姓名:{order.Name}\r\n",
 //        $"电话:{order.Mobile}\r\n",
 //        string.Join("\t\t", new string[] { "名称", "规格", "单价", "数量" }),
 //        "\r\n",
 //        string.Join("\r\n", order.Items.Select(o =>
 //        {
 //            return $"{o.Product}\t\t{o.Option}\t{o.Price}元\t{o.Count}";
 //        })),
 //        $"\r\n类型:{delivery}\r\n",
 //        $"地址:{address}");
 //}
 //public static string ToStringforPrintingOrderCode(this OnlineOrder order)
 //{
 //    return order.Code;
 //}
 //public static string ToStringforTakeout(this OnlineOrder order)
 //{
 //    return string.Empty;
 //}
 public static IEnumerable <ListViewGroup> Where(this ListViewGroupCollection collection, Func <ListViewGroup, bool> func)
 {
     foreach (var group in collection)
     {
         var listViewGroup = group as ListViewGroup;
         if (func(listViewGroup))
         {
             yield return(listViewGroup);
         }
     }
 }
Ejemplo n.º 18
0
        public static ListViewGroup GetByHeader(this ListViewGroupCollection col, string header)
        {
            foreach (ListViewGroup lvg in col)
            {
                if (lvg.Header.Equals(header))
                {
                    return(lvg);
                }
            }

            return(null);
        }
Ejemplo n.º 19
0
        public static bool ContainsKey(this ListViewGroupCollection col, string key)
        {
            foreach (ListViewGroup lvg in col)
            {
                if (lvg.Name.Equals(key))
                {
                    return(true);
                }
            }

            return(false);
        }
Ejemplo n.º 20
0
        public static bool ContainsHeader(this ListViewGroupCollection col, string header)
        {
            foreach (ListViewGroup lvg in col)
            {
                if (lvg.Header.Equals(header))
                {
                    return(true);
                }
            }

            return(false);
        }
Ejemplo n.º 21
0
        public void ListViewGroupCollection_Insert_ListViewGroup_Success()
        {
            using var listView = new ListView();
            ListViewGroupCollection collection = listView.Groups;
            var group = new ListViewGroup();

            collection.Add(new ListViewGroup());
            collection.Insert(1, group);
            Assert.Equal(2, collection.Count);
            Assert.Same(group, collection[1]);
            Assert.Same(listView, group.ListView);
        }
Ejemplo n.º 22
0
        public void ListViewGroupCollection_Contains_Invoke_ReturnsExpected()
        {
            using var listView = new ListView();
            ListViewGroupCollection collection = listView.Groups;
            var group = new ListViewGroup();

            collection.Add(group);

            Assert.True(collection.Contains(group));
            Assert.False(collection.Contains(new ListViewGroup()));
            Assert.False(collection.Contains(null));
        }
Ejemplo n.º 23
0
        public void ListViewGroupCollection_IndexOf_Invoke_ReturnsExpected()
        {
            using var listView = new ListView();
            ListViewGroupCollection collection = listView.Groups;
            var group = new ListViewGroup();

            collection.Add(group);

            Assert.Equal(0, collection.IndexOf(group));
            Assert.Equal(-1, collection.IndexOf(new ListViewGroup()));
            Assert.Equal(-1, collection.IndexOf(null));
        }
Ejemplo n.º 24
0
        //[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;
        }
Ejemplo n.º 25
0
        public void ListViewGroupCollection_Add_StringString_Success(string key, string headerText, string expectedHeaderText)
        {
            using var listView = new ListView();
            ListViewGroupCollection collection = listView.Groups;

            collection.Add(key, headerText);

            ListViewGroup group = Assert.Single(collection.Cast <ListViewGroup>());

            Assert.Equal(key, group.Name);
            Assert.Equal(expectedHeaderText, group.Header);
        }
Ejemplo n.º 26
0
        private string CreateListViewGroupName(ListViewGroupCollection collection)
        {
            ReadOnlySpan <char> listViewGroupName = nameof(ListViewGroup);

            if (Context.TryGetService(out INameCreationService nameService) &&
                Context.TryGetService(out IContainer container))
            {
                listViewGroupName = nameService.CreateName(container, typeof(ListViewGroup));
            }

            // Strip the digits from the end.
            while (char.IsDigit(listViewGroupName[^ 1]))
        public void ListViewGroupCollection_Item_SetValidIndex_GetReturnsExpected()
        {
            var listView = new ListView();
            ListViewGroupCollection collection = listView.Groups;

            collection.Add(new ListViewGroup());

            var group = new ListViewGroup();

            collection[0] = group;
            Assert.Same(group, collection[0]);
            Assert.Null(group.ListView);
        }
Ejemplo n.º 28
0
            /// <summary>
            /// Default ctor
            /// </summary>
            public LocItem(ILocState locState, ListViewGroupCollection groups)
            {
                this.locState = locState;
                this.groups   = groups;
                Text          = locState.Description;
                stateCell     = SubItems.Add("");
                speedCell     = SubItems.Add("");
                ownerCell     = SubItems.Add("");
                advCell       = SubItems.Add("");
                bool routeDurationExceededDetected;

                UpdateFromState(out routeDurationExceededDetected);
            }
Ejemplo n.º 29
0
        public void ListViewGroupCollection_Add_AlreadyInCollection_Nop()
        {
            using var listView = new ListView();
            ListViewGroupCollection collection = listView.Groups;
            var group1 = new ListViewGroup();
            var group2 = new ListViewGroup();

            Assert.Equal(0, collection.Add(group1));
            Assert.Equal(1, collection.Add(group2));

            Assert.Equal(-1, collection.Add(group1));
            Assert.Equal(2, collection.Count);
        }
Ejemplo n.º 30
0
        public void ListViewGroupCollection_CopyTo_NonEmpty_Success()
        {
            using var listView = new ListView();
            ListViewGroupCollection collection = listView.Groups;
            var group = new ListViewGroup();

            collection.Add(group);

            var array = new object[] { 1, 2, 3 };

            collection.CopyTo(array, 1);
            Assert.Equal(new object[] { 1, group, 3 }, array);
        }
	public void AddRange(ListViewGroupCollection groups) {}