private void HandleAddTabAndSelect(object sender, RoutedEventArgs e) { string code = Convert.ToString(((Control)e.Source).Tag); var accessItem = AccessList.FirstOrDefault(item => item.Item1 == code); var access = accessItem == null ? AccessType.None : accessItem.Item2; var type = (SoheilEntityType)Convert.ToInt32(((Control)e.Source).Tag); foreach (ChromeTabItem item in chrometabs.Items) { if (item.Tag != null && (SoheilEntityType)item.Tag == type) { chrometabs.SelectedItem = item; return; } } //!@#$ switch (type) { case SoheilEntityType.None: break; case SoheilEntityType.UsersMenu: break; case SoheilEntityType.UserAccessSubMenu: SplitList = new UsersVM(access); chrometabs.AddTab(CreateSplitTab(type), true); break; case SoheilEntityType.Users: SplitList = new UsersVM(access); chrometabs.AddTab(CreateSplitTab(type), true); break; case SoheilEntityType.Positions: SplitList = new PositionsVM(access); chrometabs.AddTab(CreateSplitTab(type), true); break; case SoheilEntityType.OrganizationCharts: SplitList = new OrganizationChartsVM(access); chrometabs.AddTab(CreateSplitTab(type), true); break; case SoheilEntityType.ModulesSubMenu: SplitList = new AccessRulesVM(access); chrometabs.AddTab(CreateSplitTab(type), true); break; case SoheilEntityType.Modules: SplitList = new AccessRulesVM(access); chrometabs.AddTab(CreateSplitTab(type), true); break; case SoheilEntityType.OrganizationCalendar: SplitList = new WorkProfilesVM(access); chrometabs.AddTab(CreateSplitTab(type), true); break; case SoheilEntityType.WorkProfiles: SplitList = new WorkProfilesVM(access); chrometabs.AddTab(CreateSplitTab(type), true); break; case SoheilEntityType.Holidays: SplitList = new HolidaysVM(access); chrometabs.AddTab(CreateSplitTab(type), true); break; case SoheilEntityType.WorkProfilePlan: SplitList = new WorkProfilePlansVM(access); chrometabs.AddTab(CreateSplitTab(type), true); break; case SoheilEntityType.SkillCenter: SingularList = new Soheil.Core.ViewModels.SkillCenter.SkillCenterVm(access); chrometabs.AddTab(CreateSingularTab(type), true); break; case SoheilEntityType.DefinitionsMenu: break; case SoheilEntityType.ProductsSubMenu: SplitList = new ProductsVM(access); chrometabs.AddTab(CreateSplitTab(type), true); break; case SoheilEntityType.Products: SplitList = new ProductsVM(access); chrometabs.AddTab(CreateSplitTab(type), true); break; case SoheilEntityType.Reworks: SplitList = new ReworksVM(access); chrometabs.AddTab(CreateSplitTab(type), true); break; case SoheilEntityType.DiagnosisSubMenu: SplitList = new DefectionsVM(access); chrometabs.AddTab(CreateSplitTab(type), true); break; case SoheilEntityType.Defections: SplitList = new DefectionsVM(access); chrometabs.AddTab(CreateSplitTab(type), true); break; case SoheilEntityType.Roots: SplitList = new RootsVM(access); chrometabs.AddTab(CreateSplitTab(type), true); break; case SoheilEntityType.ActionPlans: SplitList = new ActionPlansVM(access); chrometabs.AddTab(CreateSplitTab(type), true); break; case SoheilEntityType.Causes: //SplitList = new (access); break; case SoheilEntityType.FpcSubMenu: SplitList = new FpcsVm(access); chrometabs.AddTab(CreateSplitTab(type), true); break; case SoheilEntityType.Fpc: SplitList = new FpcsVm(access); chrometabs.AddTab(CreateSplitTab(type), true); break; case SoheilEntityType.Stations: SplitList = new StationsVM(access); chrometabs.AddTab(CreateSplitTab(type), true); break; case SoheilEntityType.Machines: SplitList = new MachinesVM(access); chrometabs.AddTab(CreateSplitTab(type), true); break; case SoheilEntityType.Activities: SplitList = new ActivitiesVM(access); chrometabs.AddTab(CreateSplitTab(type), true); break; case SoheilEntityType.SetupTimes: SingularList = new Core.ViewModels.SetupTime.SetupTimeTableVm(access); chrometabs.AddTab(CreateSingularTab(type), true); break; case SoheilEntityType.OperatorsSubMenu: SplitList = new OperatorsVM(access); chrometabs.AddTab(CreateSplitTab(type), true); break; case SoheilEntityType.Operators: SplitList = new OperatorsVM(access); chrometabs.AddTab(CreateSplitTab(type), true); break; case SoheilEntityType.GeneralSkills: SplitList = new GeneralSkillsVM(access); chrometabs.AddTab(CreateSplitTab(type), true); break; case SoheilEntityType.SpecialSkills: SplitList = new SpecialSkillsVM(access); chrometabs.AddTab(CreateSplitTab(type), true); break; case SoheilEntityType.CostsSubMenu: SplitList = new CostsVM(access); chrometabs.AddTab(CreateSplitTab(type), true); break; case SoheilEntityType.Costs: SplitList = new CostsVM(access); chrometabs.AddTab(CreateSplitTab(type), true); break; case SoheilEntityType.Warehouses: SplitList = new PartWarehousesVM(access); chrometabs.AddTab(CreateSplitTab(type), true); break; case SoheilEntityType.ControlMenu: break; case SoheilEntityType.ProductPlanSubMenu: case SoheilEntityType.ProductPlanTable: SingularList = new Core.ViewModels.PP.PPTableVm(access); chrometabs.AddTab(CreateSingularTab(type), true); break; case SoheilEntityType.PerformanceSubMenu: break; case SoheilEntityType.IndicesSubMenu: SingularList = new IndicesVm(access); chrometabs.AddTab(CreateSingularTab(type), true); break; case SoheilEntityType.ReportsMenu: break; case SoheilEntityType.CostReportsSubMenu: SingularList = new CostReportsVm(access); chrometabs.AddTab(CreateSingularTab(type), true); break; case SoheilEntityType.ActualCostReportsSubMenu: SingularList = new ActualCostReportsVm(access); chrometabs.AddTab(CreateSingularTab(type), true); break; case SoheilEntityType.OperationReportsSubMenu: SingularList = new OperationReportsVm(access); chrometabs.AddTab(CreateSingularTab(type), true); break; case SoheilEntityType.OptionsMenu: break; case SoheilEntityType.SettingsSubMenu: break; case SoheilEntityType.HelpSubMenu: break; case SoheilEntityType.AboutSubMenu: break; default: throw new ArgumentOutOfRangeException(); } }
private void ListUpdated(object sender, RoutedEventArgs e) { string code = Convert.ToString(((Control)e.Source).Tag); var accessItem = AccessList.FirstOrDefault(item => item.Item1 == code); var access = accessItem == null ? AccessType.None : accessItem.Item2; var type = ((SoheilEntityType)Convert.ToInt32(((Control)sender).Tag)); //!@#$ switch (type) { case SoheilEntityType.None: break; case SoheilEntityType.UsersMenu: break; case SoheilEntityType.UserAccessSubMenu: break; case SoheilEntityType.Users: ViewModel = new UsersVM(access); break; case SoheilEntityType.Positions: ViewModel = new PositionsVM(access); break; case SoheilEntityType.OrganizationCharts: ViewModel = new OrganizationChartsVM(access); break; case SoheilEntityType.ModulesSubMenu: break; case SoheilEntityType.Modules: ViewModel = new AccessRulesVM(access); break; case SoheilEntityType.WorkProfiles: ViewModel = new WorkProfilesVM(access); break; case SoheilEntityType.Holidays: ViewModel = new HolidaysVM(access); break; case SoheilEntityType.WorkProfilePlan: ViewModel = new WorkProfilePlansVM(access); break; case SoheilEntityType.DefinitionsMenu: break; case SoheilEntityType.ProductsSubMenu: break; case SoheilEntityType.Products: ViewModel = new ProductsVM(access); break; case SoheilEntityType.Reworks: ViewModel = new ReworksVM(access); break; case SoheilEntityType.DiagnosisSubMenu: break; case SoheilEntityType.Defections: ViewModel = new DefectionsVM(access); break; case SoheilEntityType.Roots: ViewModel = new RootsVM(access); break; case SoheilEntityType.ActionPlans: ViewModel = new ActionPlansVM(access); break; case SoheilEntityType.Causes: ViewModel = new CausesVM(access); break; case SoheilEntityType.FpcSubMenu: break; case SoheilEntityType.Fpc: ViewModel = new FpcsVm(access); break; case SoheilEntityType.Stations: ViewModel = new StationsVM(access); break; case SoheilEntityType.Machines: ViewModel = new MachinesVM(access); break; case SoheilEntityType.Activities: ViewModel = new ActivitiesVM(access); break; case SoheilEntityType.OperatorsSubMenu: break; case SoheilEntityType.Operators: ViewModel = new OperatorsVM(access); break; case SoheilEntityType.GeneralSkills: ViewModel = new GeneralSkillsVM(access); break; case SoheilEntityType.SpecialSkills: ViewModel = new SpecialSkillsVM(access); break; case SoheilEntityType.CostsSubMenu: break; case SoheilEntityType.Costs: ViewModel = new CostsVM(access); break; case SoheilEntityType.Warehouses: ViewModel = new PartWarehousesVM(access); break; case SoheilEntityType.ControlMenu: break; case SoheilEntityType.ProductPlanSubMenu: break; case SoheilEntityType.PerformanceSubMenu: break; case SoheilEntityType.IndicesSubMenu: break; case SoheilEntityType.OptionsMenu: break; case SoheilEntityType.SettingsSubMenu: break; case SoheilEntityType.HelpSubMenu: break; case SoheilEntityType.AboutSubMenu: break; default: throw new ArgumentOutOfRangeException(); } RefreshViewModelTemplate(); }