예제 #1
0
        /// <summary>
        /// Sucht die Gruppe und filtert die Ansicht
        /// </summary>
        public void SearchGroup()
        {
            // Prüft damit nicht der selbe Text nochmal gesucht wird
            if ((string.IsNullOrEmpty(LastSearchTextGroup) && string.IsNullOrEmpty(SearchTextGroup)) ||
                string.Equals(LastSearchTextGroup, SearchTextGroup))
            {
                return;
            }

            // Wenn wir keinen Suchtext haben
            if (string.IsNullOrEmpty(SearchTextGroup))
            {
                // Mache gefilterte Liste gleich Allen Gruppen
                GroupsFiltered = new ObservableCollection <GroupPrincipal>(AllGroups);

                // Setze letzte Suche
                LastSearchTextGroup = SearchTextGroup;

                return;
            }

            // Finde alle Items die den Text enthalten
            GroupsFiltered = new ObservableCollection <GroupPrincipal>(
                AllGroups.Where(x => x.Name.ToLower().Contains(SearchTextGroup.ToLower())));

            // Setze letzte Suche
            LastSearchTextGroup = SearchTextGroup;
        }
예제 #2
0
        public void UpdateTile()
        {
            var news = AllGroups.FirstOrDefault(c => c.UniqueId == "1").Items.ToList();
            var xml  = new XmlDocument();

            xml.LoadXml(
                string.Format(
                    @"<?xml version=""1.0"" encoding=""utf-8"" ?>
<tile>
    <visual branding=""none"">
        <binding template=""TileSquarePeekImageAndText03"">
            <image id=""1"" src=""ms-appx:///Assets/Logo.png"" alt=""alt text""/>
            <text id=""1"">{0}</text>
            <text id=""2"">{1}</text>
            <text id=""3"">{2}</text>
            <text id=""4"">{3}</text>
        </binding>
        <binding template=""TileWidePeekImageAndText02"">                        
            <image id=""1"" src=""ms-appx:///Assets/WideLogo.png"" alt=""alt text""/>
            <text id=""1"">{0}</text>
            <text id=""2"">{1}</text>
            <text id=""3"">{2}</text>
            <text id=""4"">{3}</text>
        </binding>  
    </visual>
</tile>",
                    news.Count > 0 ? System.Net.WebUtility.HtmlEncode(news[0].Title) : "",
                    news.Count > 1 ? System.Net.WebUtility.HtmlEncode(news[1].Title) : "",
                    news.Count > 2 ? System.Net.WebUtility.HtmlEncode(news[2].Title) : "",
                    news.Count > 3 ? System.Net.WebUtility.HtmlEncode(news[3].Title) : ""));
            TileUpdateManager.CreateTileUpdaterForApplication().Update(new TileNotification(xml));
        }
예제 #3
0
        public QuoteGroup AddItemToGroup(QuoteItem i, string id, string title, bool insert_begin = true)
        {
            QuoteGroup group = null;

            group = AllGroups.SingleOrDefault(s => s.UniqueId == id);
            if (group == null)
            {
                group = new QuoteGroup(id, title);

                _allGroups.Add(group);
                i.Group = group;
            }
            else
            {
                i.Group = group;
            }

            if (insert_begin)
            {
                group.Items.Insert(0, i);
            }
            else
            {
                group.Items.Add(i);
            }

            return(group);
        }
예제 #4
0
    public override void press(string name)
    {
        string ln;

        string[] split;

        string file_info  = Application.dataPath + "/info.txt";
        string file_names = Application.dataPath + "/names.txt";

        AllGroups.SetActive(false);

        using (StreamReader sc = new StreamReader(file_info))
        {
            while ((ln = sc.ReadLine()) != null)
            {
                if (ln.StartsWith(name + ";") == true)
                {
                    split = ln.Split(new char[] { ';' });

                    Name_if.text       = first_name = split[0];
                    Year_if.text       = split[1];
                    Names_if.text      = split[2];
                    Repertoire_if.text = split[3];
                    Cities_if.text     = split[4];
                    Place_if.text      = first_place = split[5];

                    break;
                }
            }
            sc.Close();
        }
    }
예제 #5
0
        public override void CalculateAdjustedFecundity( )
        {
            var lostFecunditySum  = AllGroups.Sum(x => x.LostFecundity);
            var totalFecunditySum = AllGroups.Sum(x => x.TotalFecundity);

            foreach (var group in AllGroups.Where(x => x.TotalFecundity != 0))
            {
                var term2      = (1d - V.R) * V.Y * lostFecunditySum / totalFecunditySum;
                var term1      = V.R * V.Y * group.LostFecundity / group.TotalFecundity;
                var multiplier = 1d + term1 + term2;

                foreach (var individual in group)
                {
                    individual.AdjustedFecundity = individual.Fecundity * multiplier;
                }
            }

            if (IsLoggingEnabled)
            {
                Logger.Debug("\n\nCalculate Adjusted Fecundity:\n");
                foreach (var group in AllGroups)
                {
                    Logger.Debug(group.ToTable(
                                     x => new
                    {
                        _1_Id                = x.Id,
                        _2_Qp                = $"{x.PhenotypicQuality:F4}",
                        _3_Fecundity         = $"{x.Fecundity:F4}",
                        _4_AdjustedFecundity = $"{x.AdjustedFecundity:F4}"
                    }
                                     )
                                 );
                }
            }
        }
예제 #6
0
        public object Execute()
        {
            CreatedGroup = new CredentialGroup(GroupName);
            AllGroups.Add(CreatedGroup);

            return(AllGroups);
        }
예제 #7
0
    static void Init()
    {
        if (instance)
        {
            return;
        }
        instance = new GameObject("GameManager").AddComponent <GameManager>();
        DontDestroyOnLoad(instance);

        var types = new List <Type>(Implementors.GetTypes <GameSystem>());

        types.Sort((x, y) => ((int)x.GetCustomAttribute <Priority>()).CompareTo((int)y.GetCustomAttribute <Priority>()));

        AllGroups.Add(typeof(GameSystem), new Group <GameSystem>());

        foreach (var systemType in types)
        {
            var system = Activator.CreateInstance(systemType) as GameSystem;
            Group <GameSystem> .value.Add(system);

            foreach (var Interface in systemType.GetInterfaces())
            {
                if (!AllGroups.TryGetValue(Interface, out var group))
                {
                    AllGroups[Interface] = group = Activator.CreateInstance(typeof(Group <>).MakeGenericType(Interface)) as Group;
                }
                group.Add(system);
            }
        }

        foreach (var system in SystemsWith <IOnInitialize>())
        {
            system.OnInitialize();
        }
    }
예제 #8
0
 private void Invalidate()
 {
     enabled = false;
     foreach (ContractGroup child in AllGroups.Where(g => g != null && g.parent == this))
     {
         child.Invalidate();
     }
 }
예제 #9
0
 public void UpdateGroups()
 {
     foreach (var group in _allGroups)
     {
         group.Items.Update();
     }
     AllGroups.Update();
 }
예제 #10
0
        void InvalidateItem(string type)
        {
            var item = AllGroups.SelectMany(x => x.Items).FirstOrDefault(x => x.ID == type);

            if (item == null)
            {
                return;
            }
            item.NotifyIsSelectedChanged();
        }
예제 #11
0
        public void ClearData()
        {
            AllGroups.Clear();
            AllSeries.Clear();
            AllGroupsDictionary.Clear();
            AllSeriesDictionary.Clear();
            AllAnimeDictionary.Clear();

            ViewSeriesSearch.Refresh();
        }
예제 #12
0
        /// <summary>
        /// Gets the list of proxies from HAProxy
        /// </summary>
        public static List <Proxy> GetAllProxies()
        {
            if (!Current.Settings.HAProxy.Enabled)
            {
                return(new List <Proxy>());
            }
            var instances = AllGroups.SelectMany(g => g.Instances).ToList();

            return(GetProxies(instances));
        }
예제 #13
0
파일: Artist.cs 프로젝트: sethura/vocadb
        public virtual GroupForArtist AddGroup(Artist grp)
        {
            ParamIs.NotNull(() => grp);

            var link = new GroupForArtist(grp, this);

            AllGroups.Add(link);
            grp.AllMembers.Add(link);

            return(link);
        }
예제 #14
0
        public virtual ArtistForArtist AddGroup(Artist grp, ArtistLinkType linkType)
        {
            ParamIs.NotNull(() => grp);

            var link = new ArtistForArtist(grp, this, linkType);

            AllGroups.Add(link);
            grp.AllMembers.Add(link);

            return(link);
        }
예제 #15
0
        public QuoteGroup AddGroup(string id, string title)
        {
            QuoteGroup group = AllGroups.SingleOrDefault(s => s.UniqueId == id);

            if (group == null)
            {
                group = new QuoteGroup(id, title);
                _allGroups.Add(group);
            }

            return(group);
        }
예제 #16
0
        public void RefreshGroupsSeriesData()
        {
            //LoadTestData();
            //return;

            try
            {
                // set this to null so that it will be refreshed the next time it is needed
                AllAnimeDetailedDictionary = null;

                List <JMMServerBinary.Contract_AnimeGroup>  grpsRaw   = JMMServerVM.Instance.clientBinaryHTTP.GetAllGroups(JMMServerVM.Instance.CurrentUser.JMMUserID.Value);
                List <JMMServerBinary.Contract_AnimeSeries> seriesRaw = JMMServerVM.Instance.clientBinaryHTTP.GetAllSeries(JMMServerVM.Instance.CurrentUser.JMMUserID.Value);

                if (grpsRaw.Count == 0 || seriesRaw.Count == 0)
                {
                    return;
                }

                System.Windows.Application.Current.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, (Action) delegate()
                {
                    AllGroups.Clear();
                    AllSeries.Clear();
                    AllGroupsDictionary.Clear();
                    AllSeriesDictionary.Clear();
                    AllAnimeDictionary.Clear();

                    // must series before groups the binding is based on the groups, and will refresh when that is changed
                    foreach (JMMServerBinary.Contract_AnimeSeries ser in seriesRaw)
                    {
                        AnimeSeriesVM serNew = new AnimeSeriesVM(ser);
                        AllSeries.Add(serNew);
                        AllSeriesDictionary[serNew.AnimeSeriesID.Value] = serNew;
                    }

                    ViewSeriesSearch.Refresh();

                    foreach (JMMServerBinary.Contract_AnimeGroup grp in grpsRaw)
                    {
                        AnimeGroupVM grpNew = new AnimeGroupVM(grp);
                        AllGroups.Add(grpNew);
                        AllGroupsDictionary[grpNew.AnimeGroupID.Value] = grpNew;
                    }
                });
            }
            catch (Exception ex)
            {
                Utils.ShowErrorMessage(ex);
            }
        }
예제 #17
0
        private async void GetAllGroups()
        {
            try
            {
                var groups = await remoteService.GetAllGroup();

                AllGroups.Clear();
                foreach (var item in groups)
                {
                    AllGroups.Add(item);
                }
            }
            catch
            {
            }
        }
예제 #18
0
        public void InitGroupsSeriesData()
        {
            //LoadTestData();
            //return;

            try
            {
                // set this to null so that it will be refreshed the next time it is needed
                AllAnimeDetailedDictionary = null;

                List <JMMServerBinary.Contract_AnimeGroup>  grpsRaw   = JMMServerVM.Instance.clientBinaryHTTP.GetAllGroups(JMMServerVM.Instance.CurrentUser.JMMUserID.Value);
                List <JMMServerBinary.Contract_AnimeSeries> seriesRaw = JMMServerVM.Instance.clientBinaryHTTP.GetAllSeries(JMMServerVM.Instance.CurrentUser.JMMUserID.Value);

                if (grpsRaw.Count == 0 || seriesRaw.Count == 0)
                {
                    return;
                }


                AllGroups.Clear();
                AllSeries.Clear();
                AllGroupsDictionary.Clear();
                AllSeriesDictionary.Clear();
                AllAnimeDictionary.Clear();

                // must series before groups the binding is based on the groups, and will refresh when that is changed
                foreach (JMMServerBinary.Contract_AnimeSeries ser in seriesRaw)
                {
                    AnimeSeriesVM serNew = new AnimeSeriesVM(ser);
                    AllSeries.Add(serNew);
                    AllSeriesDictionary[serNew.AnimeSeriesID.Value] = serNew;
                }

                foreach (JMMServerBinary.Contract_AnimeGroup grp in grpsRaw)
                {
                    AnimeGroupVM grpNew = new AnimeGroupVM(grp);
                    AllGroups.Add(grpNew);
                    AllGroupsDictionary[grpNew.AnimeGroupID.Value] = grpNew;
                }
            }
            catch (Exception ex)
            {
                Utils.ShowErrorMessage(ex);
            }
        }
예제 #19
0
        public override void Validate()
        {
            base.Validate();

            var dupRole = Roles.FirstOrDefault(i => AllRoles.Any(r => r != i && r.Name.EqualsIgnoreCase(i.Name)));

            if (dupRole != null)
            {
                throw new DuplicatedException(dupRole.Name);
            }

            var dupGroup = Groups.FirstOrDefault(i => AllGroups.Any(r => r != i && r.Name.EqualsIgnoreCase(i.Name)));

            if (dupRole != null)
            {
                throw new DuplicatedException(dupRole.Name);
            }
        }
예제 #20
0
        /// <summary>
        /// Update all groups
        /// </summary>
        public void UpdateGroups()
        {
            var mPath = Path.Combine(Properties.Settings.Default.SaveLocation);

            AllGroups.Clear();

            try
            {
                string[] subdirectoryEntries = Directory.GetDirectories(mPath);
                foreach (string subdirectory in subdirectoryEntries)
                {
                    string[] group = subdirectory.Split('\\');
                    AllGroups.Add(Group.CreateGroup(group[group.Length - 1]));
                }
            }
            catch
            {
            }
        }
예제 #21
0
        public static AllGroups Groups; //объекты всех групп со всеми данными

        //Сохранение в XML
        public void open_groups()
        {
            List <MyGroup> myGroups = new List <MyGroup>();
            XDocument      xdoc     = XDocument.Load(@"/storage/emulated/0/students");

            foreach (XElement e in xdoc.Element("students").Elements("group"))
            {
                string        group_name = e.Element("title").Value;
                string[]      mas        = e.Element("lessons").Value.Split(new char[] { ',' });
                List <string> les        = new List <string>();

                foreach (string el in mas)
                {
                    les.Add(el);
                }
                List <Student> st = new List <Student>();
                foreach (XElement el in e.Element("people").Elements("student"))
                {
                    string        st_name = el.Element("name").Value;
                    string[]      marks   = el.Element("marks").Value.Split(new char[] { ',' });
                    List <string> mark    = new List <string>();
                    foreach (string m in marks)
                    {
                        mark.Add(m);
                    }
                    st.Add(new Student(st_name, mark));
                }
                myGroups.Add(new MyGroup(group_name, les, st));
            }
            Groups = new AllGroups(myGroups);
            xdoc.Save(@"/storage/emulated/0/students");
            n_groups = new List <ListGroup>();
            List <ListGroup> n_group = new List <ListGroup>();

            foreach (MyGroup el in Groups.groups)
            {
                n_group.Add(new ListGroup(el.group));
            }
            n_groups = n_group;
        }
예제 #22
0
        /// <summary>
        /// Liest das AD aus und gibt eine Liste mit allen Gruppen zurück
        /// </summary>
        /// <returns></returns>
        private Task GetAllADGroups()
        {
            return(Task.Factory.StartNew(() =>
            {
                // create your domain context
                PrincipalContext ctx = new PrincipalContext(ContextType.Domain);
                GroupPrincipal qbeGrp = new GroupPrincipal(ctx);

                // Erstellt den Eintrag der während des Ladens angezeigt wird
                GroupPrincipal loading = new GroupPrincipal(ctx)
                {
                    Name = "loading ..."
                };

                // Fügt die Lade Gruppe der Liste hinzu die angezeigt wird
                GroupsFiltered = new ObservableCollection <GroupPrincipal>
                {
                    loading
                };

                // create your principal searcher passing in the QBE principal
                PrincipalSearcher srch = new PrincipalSearcher(qbeGrp);

                List <GroupPrincipal> lst = new List <GroupPrincipal>();
                // find all matches
                foreach (var found in srch.FindAll())
                {
                    if (found is GroupPrincipal grp)
                    {
                        AllGroups.Add(grp);
                    }
                }
                // Sortiert die Liste mit alles Gruppen
                AllGroups.Sort((x, y) => x.Name.CompareTo(y.Name));

                // Kopiert zum Start alle Gruppen in die gefilterte Liste
                GroupsFiltered = new ObservableCollection <GroupPrincipal>(AllGroups);
            }));
        }
예제 #23
0
        public override bool SimulateGeneration( )
        {
            ResetLists( );

            Perish1( );
            if (AllPerished)
            {
                return(false);
            }

            Perish2( );
            if (AllPerished)
            {
                return(false);
            }

            CalculateFecundity( );
            CalculateAdjustedFecundity( );
            ChooseParentsAndReproduce( );
            AddGenerationHistory( );

            return(AllGroups.All(x => x.Count != V.PopulationSize));
        }
예제 #24
0
        public DataSource()
        {
            var group_main = new DataCollection <object>(
                "Menu",
                "Menu",
                DataCollection <object> .GroupType.Menu
                );

            group_main.Items.Add(
                new DataGroupBase(
                    "Menu-1",
                    "Расписание",
                    "Courses"
                    ));
            group_main.Items.Add(
                new DataPageBase(
                    "Menu-2",
                    "Новости",
                    typeof(NewsList),
                    StringToArr()
                    ));
            group_main.Items.Add(
                new DataPageBase(
                    "Menu-3",
                    "Видео",
                    typeof(VideoList),
                    StringToArr()
                    ));
            group_main.Items.Add(
                new DataGroupBase(
                    "Menu-4",
                    "Игры",
                    "Games"
                    ));

            AllGroups.Add(group_main);
        }
예제 #25
0
        private void LoadTestData()
        {
            System.Windows.Application.Current.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, (Action) delegate()
            {
                AllGroups.Clear();
                AllSeries.Clear();

                AnimeGroupVM grpNew = new AnimeGroupVM();
                grpNew.GroupName    = grpNew.SortName = "Bleach";
                AllGroups.Add(grpNew);

                grpNew           = new AnimeGroupVM();
                grpNew.GroupName = grpNew.SortName = "Naruto";
                AllGroups.Add(grpNew);

                grpNew           = new AnimeGroupVM();
                grpNew.GroupName = grpNew.SortName = "High School of the Dead";
                AllGroups.Add(grpNew);

                grpNew           = new AnimeGroupVM();
                grpNew.GroupName = grpNew.SortName = "Gundam";
                AllGroups.Add(grpNew);
            });
        }
예제 #26
0
        public DataSource()
        {
            const string itemContent = "Content";

            var dataGroup = new DataCollection(
                "Group-1",
                "Group Title: 3",
                "Group Subtitle: 3",
                MediumGrayImage,
                string.Empty);

            dataGroup.Items.Add(
                new DataItem(
                    "Group-1-Item-1",
                    "Custom Controls",
                    string.Empty,
                    DarkGrayImage,
                    "Building custom controls",
                    itemContent,
                    dataGroup,
                    typeof(CustomManipulation)));

            AllGroups.Add(dataGroup);
        }
예제 #27
0
    public override void press(string name)
    {
        AllGroups.SetActive(false);

        text.text = name;
    }
예제 #28
0
        public object Undo()
        {
            AllGroups.Remove(CreatedGroup);

            return(AllGroups);
        }
예제 #29
0
        public object Redo()
        {
            AllGroups.Add(CreatedGroup);

            return(AllGroups);
        }
예제 #30
0
 public void DeleteGroup(string groupName)
 {
     AllGroups.Delete(_view, groupName);
     App.Cloud.UpdateAllGroups(AllGroups);
 }