Esempio n. 1
0
 public SizeGroupDescription()
 {
     foreach (string sizeGroup in sSizeGroups)
     {
         GroupNames.Add(sizeGroup);
     }
 }
Esempio n. 2
0
        void HandleEntityAdded(object sender, EntityEventArgs <Group> e)
        {
            IGroupListItemViewModel groupListItemViewModel = CreateItem(e.Entity.Clone());

            GroupNames.Add(groupListItemViewModel);
            SelectedItem = groupListItemViewModel;
        }
        internal bool UpdateState(Menu oldMenu, Item item, Update update, bool reset = true)
        {
            if (reset)
            {
                oldMenu.CleanUp();
                GroupNames.Clear();

                foreach (var group in BlockGroups)
                {
                    group.Clear();
                    MembersPool.Return(group);
                }

                BlockGroups.Clear();

                foreach (var group in Ai.BlockGroups)
                {
                    var groupName = group.Key;
                    GroupNames.Add(groupName);
                    var membersList = MembersPool.Get();

                    foreach (var comp in group.Value.Comps)
                    {
                        var groupMember = new GroupMember {
                            Comp = comp, Name = groupName
                        };
                        membersList.Add(groupMember);
                    }
                    BlockGroups.Add(membersList);
                }
            }

            var groupReady = BlockGroups.Count > 0;

            if (groupReady)
            {
                switch (update)
                {
                case Update.Parent:
                    _currentMenu = item.ParentName;
                    break;

                case Update.Sub:
                    _currentMenu = item.SubName;
                    break;

                default:
                    break;
                }
                var menu = Menus[_currentMenu];
                if (menu.ItemCount <= 1)
                {
                    menu.LoadInfo(reset);
                }
            }

            return(groupReady);
        }
            public TypeGroupDescription()
            {
                GroupNames.Add(null);
                var setting = UserSettings.Instance.General.SortCharactersFirst;

                if (setting)
                {
                    GroupNames.Add(CharactersGroup);
                }
                GroupNames.Add(ChannelsGroup);
                if (!setting)
                {
                    GroupNames.Add(CharactersGroup);
                }
            }
        // group names extracted from path to textures and overall quantity of groups
        private static void GroupNameCreation()
        {
            GroupNames.Add(
                GetGroupNameFromPath(PathToTextures, false, '/')
                );

            string[] subdirectories = Directory.GetDirectories(PathToTextures);
            for (Int32 i = 0; i < subdirectories.Length; ++i)
            {
                GroupNames.Add(
                    GetGroupNameFromPath(subdirectories[i], true, '/')
                    );
            }

            GroupCount     = subdirectories.Length + 1;
            subdirectories = null;
        }
Esempio n. 6
0
 public List <string> GetGroupMembers(string groupName)
 {
     GroupNames.Add(groupName);
     return(Current.LocalCache.GetSet <List <string> >("ADMembers-" + groupName,
                                                       (old, _) =>
     {
         using (MiniProfiler.Current.Step("Getting members for " + groupName))
         {
             var group = RunCommand(pc =>
             {
                 using (var gp = GroupPrincipal.FindByIdentity(pc, groupName))
                 {
                     return gp?.GetMembers(true).ToList().Select(mp => mp.SamAccountName).ToList() ?? new List <string>();
                 }
             });
             return group ?? old ?? new List <string>();
         }
     }, 5.Minutes(), 24.Hours()));
 }
Esempio n. 7
0
 /// <summary>
 /// Selects or deselects a group for frame design.
 /// </summary>
 /// <param name="group">An existing group.</param>
 /// <param name="selectForDesign">True: The specified group is selected as a design group for steel design.
 /// False: The group is not selected for steel design.</param>
 /// <exception cref="CSiException"><see cref="CSiApiBase.API_DEFAULT_ERROR_CODE" /></exception>
 private void set(Group group, bool selectForDesign)
 {
     if (selectForDesign)
     {
         if (!GroupNames.Contains(group.Name))
         {
             GroupNames.Add(group.Name);
         }
         if (!Groups.Contains(group))
         {
             _designGroups.Add(group);
         }
     }
     else
     {
         GroupNames.Remove(group.Name);
         _designGroups.Remove(group);
     }
 }
Esempio n. 8
0
        public bool InitWndControls()
        {
            using (var wrapper = new DisposableWrapper <ShowAsyncResult>(CWaitingWnd.ShowAsync(Title,
                                                                                               Properties.Resources.resFillingGenerationFromOnlineBDWnd,
                                                                                               this,
                                                                                               CheckAccess()),
                                                                         asyncResult =>
            {
                if (asyncResult?.hFinishedSearchEvent != null)
                {
                    asyncResult.hFinishedSearchEvent.Set();
                }
            }))
            {
                EndYears.Clear();
                StartYears.Clear();
                EndYears.Add((int)enEndYearSpecVals.AndYounger);
                EndYears.Add((int)enEndYearSpecVals.AndElder);
                for (int i = DateTime.Now.Year - 7; i > DateTime.Now.Year - 100; i--)
                {
                    StartYears.Add(i);
                    EndYears.Add(i);
                }


                GroupNames.Clear();
                lock (DBManagerApp.m_AppSettings.m_SettingsSyncObj)
                {
                    foreach (var groupNameDesc in DBManagerApp.m_AppSettings.m_Settings.AvailableGroupNames)
                    {
                        GroupNames.Add(groupNameDesc.GroupName);
                    }
                }

                // Заполняем выпадающие списки текущими значениями
                LocalDBComps.Clear();

                try
                {
                    foreach (var comp in DBManagerApp.m_Entities.descriptions.ToList())
                    {
                        var item = new CompDescLocalWorkbook()
                        {
                            ID        = comp.id_desc,
                            Name      = comp.name,
                            StartDate = DateTime.Today,
                            EndDate   = DateTime.Today.AddDays(2)
                        };
                        item.DestCompFolder   = GetDefaultDestCompFolderName(item);
                        item.PropertyChanged += comp_PropertyChanged;

                        LocalDBComps.Add(item);
                    }
                    SelectedComp = LocalDBComps.LastOrDefault();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(this,
                                    string.Format(Properties.Resources.resfmtErrorDuringReadingDataFromOnlineDB, ex.Message),
                                    Title,
                                    MessageBoxButton.OK,
                                    MessageBoxImage.Error);
                    return(false);
                }

                cmbMainJudge.Items.Clear();
                foreach (var mainJudge in DBManagerApp
                         .m_Entities
                         .groups
                         .Select(arg => arg.main_judge)
                         .Where(arg => !string.IsNullOrEmpty(arg))
                         .Distinct())
                {
                    cmbMainJudge.Items.Add(mainJudge);
                }

                cmbMainSecretary.Items.Clear();
                foreach (var mainSecretary in DBManagerApp
                         .m_Entities
                         .groups
                         .Select(arg => arg.main_secretary)
                         .Where(arg => !string.IsNullOrEmpty(arg))
                         .Distinct())
                {
                    cmbMainSecretary.Items.Add(mainSecretary);
                }

                cmbRow6.Items.Clear();
                foreach (var row6 in DBManagerApp
                         .m_Entities
                         .groups
                         .Select(arg => arg.row6)
                         .Where(arg => !string.IsNullOrEmpty(arg))
                         .Distinct())
                {
                    cmbRow6.Items.Add(row6);
                }
            }

            return(true);
        }
Esempio n. 9
0
        private Dictionary <byte, TokenDictionaryEntry> GetTokensFromNode(XmlNodeList nodes, out List <string> alts, string prevBytes = "")
        {
            Dictionary <byte, TokenDictionaryEntry> currentTokens = new Dictionary <byte, TokenDictionaryEntry>();

            alts = new List <string>();
            foreach (XmlNode node in nodes)
            {
                //alts = new List<string>();
                if (node.NodeType != XmlNodeType.Comment)
                {
                    if (node.Name == "Token")
                    {
                        byte key = getByteFromXml(node);

                        TokenDictionaryEntry value = new TokenDictionaryEntry()
                        {
                            Byte = key
                        };

                        if (node.Attributes["string"] != null)
                        {
                            value.Name = node.Attributes["string"].Value;
                            if (value.Name == "\\n")
                            {
                                value.Name = "\n";
                            }

                            if (node.Attributes["comment"] != null)
                            {
                                string comment = Regex.Unescape(node.Attributes["comment"].Value);
                                value.Comment = comment;
                                if (!Comments.ContainsKey(value.Name))
                                {
                                    Comments.Add(value.Name, comment);
                                }
                            }

                            if (node.Attributes["site"] != null)
                            {
                                string site = node.Attributes["site"].Value;
                                value.Site = site;
                                if (!Sites.ContainsKey(value.Name))
                                {
                                    Sites.Add(value.Name, site);
                                }
                            }

                            if (node.Attributes["group"] != null)
                            {
                                value.Group = node.Attributes["group"].Value;
                                if (!GroupNames.Contains(value.Group))
                                {
                                    GroupNames.Add(value.Group);
                                }
                            }
                            else
                            {
                                value.Group = "_default";
                            }

                            if (!Groups.ContainsKey(value.Name))
                            {
                                Groups.Add(value.Name, value.Group);
                            }

                            if (node.Attributes["style"] != null)
                            {
                                value.StyleType = node.Attributes["style"].Value;
                            }

                            if (node.Attributes["stringTerminator"] != null)
                            {
                                bool term;
                                value.StringTerminator = bool.TryParse(node.Attributes["stringTerminator"].Value, out term) ? term : false;
                            }

                            if (node.Attributes["stringStarter"] != null)
                            {
                                bool term;
                                value.StringStarter = bool.TryParse(node.Attributes["stringStarter"].Value, out term) ? term : false;
                            }

                            if (node.Attributes["indentGroup"] != null)
                            {
                                value.IndentGroup = node.Attributes["indentGroup"].Value;
                            }

                            if (node.Attributes["indentGroupTerminator"] != null)
                            {
                                if (string.IsNullOrEmpty(value.IndentGroup))
                                {
                                    throw new ArgumentException(string.Format("Cannot have indentGroupTerminator without indentGroup. On token {0}.", value.Name));
                                }

                                bool term;
                                value.IndentGroupTerminator = bool.TryParse(node.Attributes["indentGroupTerminator"].Value, out term) ? term : false;
                            }

                            string bytes = prevBytes + key.ToString("X2");
                            value.Bytes = bytes;
                            StringToBytesTrie.AddData(value.Name, bytes);
                            BytesToStringTrie.AddData(HexHelper.GetByteArray(bytes), value);
                        }
                        List <string> myAlts = new List <string>();
                        if (node.HasChildNodes)
                        {
                            value.SubTokens = GetTokensFromNode(node.ChildNodes, out myAlts, prevBytes + key.ToString("X2"));
                        }
                        currentTokens.Add(key, value);
                        if (value.Name != null)
                        {
                            if (FlatTokens.ContainsKey(value.Name))
                            {
                                throw new AmbiguousTokenException(value.Name);
                            }
                            FlatTokens.Add(value.Name, value);
                            foreach (string alt in myAlts)
                            {
                                if (FlatTokens.ContainsKey(alt))
                                {
                                    throw new AmbiguousTokenException(string.Format("{0} alt: ({1})", value.Name, alt));
                                }
                                value.Alts.Add(alt);
                                FlatTokens.Add(alt, value);
                            }
                            myAlts.Clear();
                        }
                    }
                    else if (node.Name == "Alt")
                    {
                        string alt = node.Attributes["string"].Value;
                        StringToBytesTrie.AddData(alt, prevBytes);
                        alts.Add(alt);
                    }
                }
            }

            return(currentTokens);
        }