示例#1
0
        private void CurrentOnExit(object sender, ExitEventArgs e)
        {
            Application.Current.Exit -= CurrentOnExit;
            foreach (var tab in WorkAreaVM.Tabs)
            {
                tab.Content.CasesCanvasVM.UpdateCasesPositions();
            }

            CasesStatesOperations.SaveState();
            ColumnSettingsOperations.SaveState();
        }
示例#2
0
        public static void AddTabWithCases(ObservableCollection <CaseControlVM> cases)
        {
            if (cases.Count == 0)
            {
                return;
            }
            var tabIdent = GenerateNewTabName();
            var content  = new SortBarPannelVM(tabIdent);

            content.PopulateCases((cases.Select(o => o.CaseModel.CaseNumber)).ToArray());
            Tabs.Add(new TabsContainer(content));
            CasesStatesOperations.UpdateCasesPositions(cases.ToList(), null, tabIdent);
            cases.Clear();
        }
示例#3
0
        public WorkAreaVM()
        {
            Tabs = new ObservableCollection <TabsContainer>();
            TabsContainer.Container = Tabs;

            try
            {
                foreach (var tab in CasesStatesOperations.GetTabs())
                {
                    Tabs.Add(new TabsContainer(new SortBarPannelVM(tab)));
                }
            }
            catch (Exception e)
            {
                LoggerController.Log(e.Message);
            }
            AddEmptyTab = new RelayCommand(DoAddEmptyTab);
        }
示例#4
0
 internal void RemoveLabel(CellLabelVM cellLabelVM)
 {
     CasesStatesOperations.RemoveLabel(cellLabelVM.Guid, _previousQueue, TabHeader);
     CellLabels.Remove(cellLabelVM);
 }
示例#5
0
 internal void RemoveCase(CaseControlVM caseControl)
 {
     CaseControls.Remove(caseControl);
     CasesStatesOperations.RemoveCase(caseControl, _previousQueue, TabHeader);
 }
示例#6
0
 internal void UpdateCasesPositions()
 {
     CasesStatesOperations.UpdateCasesPositions(CaseControls.ToList(), _previousQueue, TabHeader);
     CasesStatesOperations.UpdateLabelsPositions(CellLabels.ToList(), _previousQueue, TabHeader);
 }
示例#7
0
        private async Task BuildCasesAsync(string selection)
        {
            if (!string.IsNullOrEmpty(_previousQueue))
            {
                UpdateCasesPositions();
            }
            CaseControls.Clear();
            CellLabels.Clear();
            IList <ICase> casesData = default;

            try
            {
                _isBusyBuildCases = true;
                casesData         = await Task.Run(() => SFConnector.Instance.GetCasesAsync(selection));
            }
            catch (Exception e)
            {
                LoggerController.Log(e.Message);
            }

            _previousQueue = selection;
            LoggerController.Log(casesData.Count + $" cases Retrived.");
            CaseControls = await Task.Run(() =>
            {
                ObservableCollection <CaseControlVM> cc = new ObservableCollection <CaseControlVM>();
                foreach (var item in casesData)
                {
                    var caseViewModel = new CaseControlVM(item, this);
                    cc.Add(caseViewModel);
                    CaseInfo positionInfo = null;
                    try
                    {
                        positionInfo = CasesStatesOperations.GetCaseInfo(item.CaseNumber, selection, TabHeader);
                    }
                    catch (Exception e)
                    {
                        LoggerController.Log(e.Message);
                    }
                    if (positionInfo != null)
                    {
                        caseViewModel.Index = positionInfo.Index;
                    }
                }
                return(cc);
            }
                                          );

            try
            {
                //Add Labels from JSON
                var caseslist = await Task.Run(() => CasesStatesOperations.GetCasesList(selection, TabHeader));

                foreach (LabelInfo item in caseslist.Labels.Values)
                {
                    var success = Guid.TryParse(item.Guid, out Guid guid);
                    if (!success)
                    {
                        continue;
                    }
                    CellLabels.Add(new CellLabelVM(this, item.Left, item.Top, item.Width, item.Height, item.Note, guid));
                }
            }
            catch (Exception e)
            {
                LoggerController.Log(e.Message);
            }
            finally
            {
                _isBusyBuildCases = false;
            }
        }
示例#8
0
 private void DoCloseTab()
 {
     Container.Remove(this);
     CasesStatesOperations.RemoveTab(this.Content.CasesCanvasVM.TabHeader);
 }