示例#1
0
        public MainViewModel()
        {
            CreateCommands();

            ConfigManager = new MainConfigManager();
            ConfigManager.LoadConfigs();
            ClientDirsManager.Inst.LoadDirs();

            Racks      = new ObservableCollection <Rack>();
            Trays      = new ObservableCollection <Tray>();
            Parts      = new ObservableCollection <Part>();
            Categories = new ObservableCollection <string>();

            Racks.Add(new Rack(3, 3));
            CurrentSelectCategory = "All";
            Parts = PartsFileRepository.LoadParts();
            CategoriesRefresh();
            SelectCategoryCommand.Execute();

            LogicUnits    = new ObservableCollection <LogicUnitViewModel>();
            PcdmisClient  = PcdmisClient.Inst;
            CalypsoClient = CalypsoClient.Inst;
            Trays         = TraysRepository.LoadTrays();
            Started       = false;
            Stopped       = true;
            RunLedIndex   = -1;
            LogsManager   = ClientLogs.Inst;
            PLCAccessor   = PLCAccessor.Instance;

            LoadOrUnloadError = false;
            MyEventAggregator.Inst.GetEvent <PlcErrorEvent>().Subscribe(OnPlcError);
            MyEventAggregator.Inst.GetEvent <LoadEvent>().Subscribe(OnLoadActivity);
            MyEventAggregator.Inst.GetEvent <UnloadEvent>().Subscribe(OnUnloadActivity);
        }
示例#2
0
        private void AddPart()
        {
            CategoriesRefresh();
            AddPartWindow addPartWindow = new AddPartWindow();

            addPartWindow.Parts = Parts;
            addPartWindow.ShowDialog();
            CategoriesRefresh();
            PartsFileRepository.UpdateParts(Parts);
        }
示例#3
0
 private void DeletePart()
 {
     if (SelectedPart == null)
     {
         return;
     }
     //if (SelectedPart.Status != PartStatus.PS_Idle)
     //{
     //    return;
     //}
     if (SelectedPart.Placed)
     {
         return;
     }
     Parts.Remove(SelectedPart);
     SelectParts.Remove(SelectedPart);
     CategoriesRefresh();
     PartsFileRepository.UpdateParts(Parts);
 }
示例#4
0
 private void DeleteAllParts()
 {
     //须判断是否放置在料盘中
     foreach (var part in Parts)
     {
         if (part.Placed)
         {
             MessageBox.Show("有未卸载零件,无法清除", "警告", MessageBoxButton.OK, MessageBoxImage.Exclamation, MessageBoxResult.OK, MessageBoxOptions.DefaultDesktopOnly);
             return;
         }
     }
     Parts.Clear();
     if (SelectParts != null)
     {
         SelectParts.Clear();
     }
     CategoriesRefresh();
     PartsFileRepository.UpdateParts(Parts);
 }