Example #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);
        }
Example #2
0
    public T GetConfig <T>() where T : Config
    {
        System.Type type = typeof(T);

        BaseConfigManager baseConfig = MainConfigManager.GetInstance();
        Config            config     = baseConfig.GetConfig <T>();

        if (config != null)
        {
            return(config as T);
        }

        return(null);
    }
Example #3
0
    public static MainConfigManager GetInstance()
    {
        if (_instance == null)
        {
            lock (_lockHelper)
            {
                if (_instance == null)
                {
                    _instance = new MainConfigManager();
                }
            }
        }

        return(_instance);
    }
Example #4
0
    IEnumerator Start()
    {
        yield return(MainConfigManager.GetInstance().Initialize());

        _playerInfo = PlayerInfo.Instance();
        _model      = LotPlayer.Instance();
        View.Initionlize();
        View.InitByData(_playerInfo, _model);
        int cost = _model.GetCurrentTurnGameCost(false);

        if (cost != 0)
        {
            View.ShowCostPage(cost);
        }
        else
        {
            _model.GetCurrentTurnGameCost(true);
        }
    }