예제 #1
0
        public SortBarPannelVM(CasesTab tab) : this(tab.TabIdentifier)
        {
            var customTab = tab.CasesLists.FirstOrDefault(o => o.CasesQueueName == null);

            if (customTab != null)
            {
                CasesCanvasVM.BuildCasesFromStorage.ExecuteAsync(customTab.Cases);//.FireAndForgetSafeAsync();
                CasesCanvasVM.BuildLabelsFromStorage(customTab.Labels);
            }
        }
        public static CasesList GetCasesList(string caseQueueName, string tabIdentifier)
        {
            //TODO:Cenvert to async
            if (_casesState.CasesTabs == null)
            {
                _casesState.CasesTabs = new List <CasesTab>();
            }

            var tab = _casesState.CasesTabs.FirstOrDefault(ct => ct.TabIdentifier == tabIdentifier);

            if (tab == null)
            {
                tab = new CasesTab
                {
                    TabIdentifier = tabIdentifier,
                    CasesLists    = new List <CasesList>
                    {
                        new CasesList
                        {
                            CasesQueueName = caseQueueName,
                            Cases          = new Dictionary <string, CaseInfo>(),
                            Labels         = new Dictionary <string, LabelInfo>()
                        }
                    }
                };
                _casesState.CasesTabs.Add(tab);
            }

            var list = tab.CasesLists.FirstOrDefault(o => o.CasesQueueName == caseQueueName);

            if (list == null)
            {
                list = new CasesList
                {
                    CasesQueueName = caseQueueName,
                    Cases          = new Dictionary <string, CaseInfo>(),
                    Labels         = new Dictionary <string, LabelInfo>()
                };
                tab.CasesLists.Add(list);
            }
            if (list.Labels == null)
            {
                list.Labels = new Dictionary <string, LabelInfo>();
            }

            return(list);
        }