예제 #1
0
        private static void LoadConfiguration()
        {
            FileManager.Instance.RegisterFileType();
            var jsonValue = SerializeUtil.JsonReadByFile <GlobalParameters>(GlobalModel.ConfigFileName);

            if (jsonValue != null)
            {
                GlobalModel.Params = jsonValue;

                #region Check if valid
                var layers = GlobalModel.Params.LayerConfig.LayerCrafts;
                if (layers.Count != 15)
                {
                    for (int i = 0; i < 15; i++)
                    {
                        layers[i + 1] = DefaultParaHelper.GetDefaultLayerCraftModel();
                    }
                }
                #endregion
            }
            else
            {
                GlobalModel.Params.LayerConfig = DefaultParaHelper.GetDefaultLayerConfigModel();
            }
            SystemContext.SystemPara = SystemConfig.Load(@".\Configs\SysConfig.json");
            LoadUnitInfo();
        }
예제 #2
0
        public UCLayerCraftPara(LayerCraftModel model, string key) : this()
        {
            this.Model = this.mvvmContext1.GetViewModel <LayerCraftModel>();
            this.key   = key;
            CopyUtil.CopyModel(this.Model, model ?? DefaultParaHelper.GetDefaultLayerCraftModel());
            this.InitializeBindings();
            this.InitializeCurve();
            var monitor = new UnitMonitor(this, () => this.Model.RaisePropertiesChanged());

            monitor.Listen();
            UnitObserverFacade.Instance.SpeedUnitObserver.UnitChanged += x => this.InitializeCurve();
        }