private static void UpdateProviderList(CheckedListBox.ObjectCollection items, string targetServer = null)
 {
     if (Providers == null)
     {
         Providers = new System.Collections.Generic.List <string>(SystemEventEnumerator.GetEventProviders(targetServer, null, true));
     }
     items.Clear();
     items.AddRange(Providers.ConvertAll <DropDownCheckListItem>(s => { var p = s.Split('|'); return(new DropDownCheckListItem(p[1], p[0])); }).ToArray());
 }
Esempio n. 2
0
 public void loadFileList()
 {
     if (Directory.Exists(this.importPath))
     {
         CheckedListBox.ObjectCollection items = chkFileList.Items;
         items.Clear();
         IEnumerable <string> files = Directory.EnumerateFiles(this.importPath, "*.xml", SearchOption.TopDirectoryOnly);
         foreach (string fileName in files)
         {
             string[] fn   = fileName.Split('\\');
             string   name = fn[fn.Length - 1];
             items.Add(name);
         }
     }
     chkFileList.Refresh();
     Console.Out.WriteLine("File List loaded");
 }
        /// <summary>
        ///
        /// </summary>
        public void FillData(Dictionary <MemberModel, ClassModel> members, ClassModel cm)
        {
            String label;

            this.members = members;
            String separatorInserted = null;

            members2 = new Dictionary <String, MemberModel>();
            CheckedListBox.ObjectCollection items = checkedListBox.Items;
            Dictionary <MemberModel, ClassModel> .KeyCollection keys = members.Keys;
            items.Clear(); // Clear items...
            foreach (MemberModel member in keys)
            {
                String qname = members[member].QualifiedName;
                if (separatorInserted != qname)
                {
                    separatorInserted = qname;
                    items.Add("--- " + qname);
                }
                label = TemplateUtils.ToDeclarationString(member, TemplateUtils.GetTemplate("MethodDeclaration"));
                label = label.Replace(SnippetHelper.BOUNDARY, "")
                        .Replace(SnippetHelper.ENTRYPOINT, "")
                        .Replace(SnippetHelper.EXITPOINT, "");
                if ((member.Flags & FlagType.Getter) > 0)
                {
                    label = "get " + label;
                }
                else if ((member.Flags & FlagType.Setter) > 0)
                {
                    label = "set " + label;
                }

                items.Add(label, false);
                members2.Add(label, member);
            }
        }
Esempio n. 4
0
        /// <summary>
        ///
        /// </summary>
        public void FillData(Dictionary <MemberModel, ClassModel> members, ClassModel cm)
        {
            String label;

            this.members = members;
            String separatorInserted = null;

            members2 = new Dictionary <String, MemberModel>();
            CheckedListBox.ObjectCollection items = checkedListBox.Items;
            Dictionary <MemberModel, ClassModel> .KeyCollection keys = members.Keys;
            items.Clear(); // Clear items...
            foreach (MemberModel member in keys)
            {
                String qname = members[member].QualifiedName;
                if (separatorInserted != qname)
                {
                    separatorInserted = qname;
                    items.Add("--- " + qname);
                }
                label = member.ToDeclarationString();
                items.Add(label, false);
                members2.Add(label, member);
            }
        }
Esempio n. 5
0
        /// <summary>
        /// Task to refresh PAK items.
        /// </summary>
        /// <returns></returns>
        public static async Task RefreshList()
        {
            await Task.Delay(2000);

            CheckedListBox listBox = (Application.OpenForms[0] as Encdec).listBox;

            CheckedListBox.ObjectCollection collection = listBox.Items;

            Directory.CreateDirectory(Program.Arguments.Input);
            while (true)
            {
                if (ExplorerCollection.Count != Directory.GetFiles(Program.Arguments.Input, "*.pak").Length)
                {
                    ExplorerCollection.Clear();
                    listBox.Invoke(new Action(() => collection.Clear()));

                    List <string> paks = Directory.GetFiles(Program.Arguments.Input, "*.pak")
                                         .Select(item => item.Replace(Program.Arguments.Input + "\\", "")).ToList();
                    ExplorerCollection.AddRange(paks);
                    listBox.Invoke(new Action(() => collection.AddRange(paks.ToArray())));
                }
                await Task.Delay(1000);
            }
        }
Esempio n. 6
0
        public static void SetLanguage(CheckedListBox.ObjectCollection items, Type type)
        {
            StringCollection saveKeys = new StringCollection();

            for (int idx = 0; idx < items.Count; idx++)
            {
                common.myComboBoxItem item = (common.myComboBoxItem)items[idx];
                saveKeys.Add(item.Value);
            }
            if (type == typeof(AppTypes.TimeScale))
            {
                items.Clear();
                for (int idx = 0; idx < saveKeys.Count; idx++)
                {
                    object obj = FindTimeScaleByCode(saveKeys[idx]);
                    if (obj == null)
                    {
                        continue;
                    }
                    AppTypes.TimeScale item = (AppTypes.TimeScale)obj;
                    items.Add(new common.myComboBoxItem(item.Description, item.Code));
                }
                return;
            }

            if (type == typeof(AppTypes.TradeActions))
            {
                items.Clear();
                for (int idx = 0; idx < saveKeys.Count; idx++)
                {
                    object obj = FindCodeInEnum(saveKeys[idx], typeof(AppTypes.TradeActions));
                    if (obj == null)
                    {
                        continue;
                    }
                    AppTypes.TradeActions item = (AppTypes.TradeActions)obj;
                    items.Add(new common.myComboBoxItem(AppTypes.Type2Text(item), item.ToString()));
                }
                return;
            }

            if (type == typeof(AppTypes.TimeRanges))
            {
                items.Clear();
                for (int idx = 0; idx < saveKeys.Count; idx++)
                {
                    object obj = FindCodeInEnum(saveKeys[idx], typeof(AppTypes.TimeRanges));
                    if (obj == null)
                    {
                        continue;
                    }
                    AppTypes.TimeRanges item = (AppTypes.TimeRanges)obj;
                    items.Add(new common.myComboBoxItem(AppTypes.Type2Text(item), item.ToString()));
                }
                return;
            }
            if (type == typeof(AppTypes.StrategyTypes))
            {
                items.Clear();
                for (int idx = 0; idx < saveKeys.Count; idx++)
                {
                    object obj = FindCodeInEnum(saveKeys[idx], typeof(AppTypes.StrategyTypes));
                    if (obj == null)
                    {
                        continue;
                    }
                    AppTypes.StrategyTypes item = (AppTypes.StrategyTypes)obj;
                    items.Add(new common.myComboBoxItem(AppTypes.Type2Text(item), item.ToString()));
                }
                return;
            }
            if (type == typeof(AppTypes.Sex))
            {
                items.Clear();
                for (int idx = 0; idx < saveKeys.Count; idx++)
                {
                    object obj = FindCodeInEnum(saveKeys[idx], typeof(AppTypes.Sex));
                    if (obj == null)
                    {
                        continue;
                    }
                    AppTypes.Sex item = (AppTypes.Sex)obj;
                    items.Add(new common.myComboBoxItem(AppTypes.Type2Text(item), item.ToString()));
                }
                return;
            }
            if (type == typeof(AppTypes.CommonStatus))
            {
                items.Clear();
                for (int idx = 0; idx < saveKeys.Count; idx++)
                {
                    object obj = FindCodeInEnum(saveKeys[idx], typeof(AppTypes.CommonStatus));
                    if (obj == null)
                    {
                        continue;
                    }
                    AppTypes.CommonStatus item = (AppTypes.CommonStatus)obj;
                    items.Add(new common.myComboBoxItem(AppTypes.Type2Text(item), item.ToString()));
                }
                return;
            }
            if (type == typeof(AppTypes.ChartTypes))
            {
                items.Clear();
                for (int idx = 0; idx < saveKeys.Count; idx++)
                {
                    object obj = FindCodeInEnum(saveKeys[idx], typeof(AppTypes.ChartTypes));
                    if (obj == null)
                    {
                        continue;
                    }
                    AppTypes.ChartTypes item = (AppTypes.ChartTypes)obj;
                    items.Add(new common.myComboBoxItem(AppTypes.Type2Text(item), item.ToString()));
                }
                return;
            }
            if (type == typeof(AppTypes.BizSectorTypes))
            {
                items.Clear();
                for (int idx = 0; idx < saveKeys.Count; idx++)
                {
                    object obj = FindCodeInEnum(saveKeys[idx], typeof(AppTypes.BizSectorTypes));
                    if (obj == null)
                    {
                        continue;
                    }
                    AppTypes.BizSectorTypes item = (AppTypes.BizSectorTypes)obj;
                    items.Add(new common.myComboBoxItem(AppTypes.Type2Text(item), item.ToString()));
                }
                return;
            }
        }