public InfoPageViewModel()
 {
     js = new JsonAccess
     {
         SchoolPath = "_SchoolData.json",
         GradePath  = "_GradeData.json"
     };
 }
Exemple #2
0
        public MsgBoxAddItems()
        {
            InitializeComponent();
            viewModelObj     = new MsgBoxAddItemsViewModel();
            this.DataContext = viewModelObj;


            js = new JsonAccess
            {
                SchoolPath = "_SchoolData.json"
            };
        }
        public MsgBoxAddStudent()
        {
            InitializeComponent();
            viewModelObj = new MsgBoxAddStudentViewModel();
            DataContext  = viewModelObj;

            js = new JsonAccess
            {
                SchoolPath = "_SchoolData.json",
                GradePath  = "_GradeData.json"
            };
        }
Exemple #4
0
        public void GenerateJsonStep2()
        {
            log.Debug("start the step2 to modify the json file");
            string jsonFile = Directory.EnumerateFiles(jsonFileFolder, "*").FirstOrDefault();

            if (string.IsNullOrEmpty(jsonFile))
            {
                log.DebugFormat("Don't find the json template under Path: {0}", jsonFileFolder);
                return;
            }
            JsonAccess.UpdateJsonTemplate(jsonFile, ServiceLocator.Current.GetInstance <OSBuildConfigure_ViewModel>().GeneralData);
            log.Debug("step2 completed");
        }
        // TO DO[OPTIONAL]: Clean up this method.
        private static void RunOption(OptionTypes option)
        {
            switch (option)
            {
            case OptionTypes.ParseCsv:
                var container = CsvAccess.ParseCsv();

                if (container == null)
                {
                    return;
                }

                // Add default update times (hard coded).
                container.UpdateTimes.AddRange(UpdateTime.DefaultUpdateTimes);
                // Add default projects (hard coded). Currently empty!!!
                container.Projects.AddRange(Project.DefaultProjects());

                File.WriteAllText(JsonAccess.DefaultFilename, JsonConvert.SerializeObject(container, Formatting.Indented));

                return;

            case OptionTypes.RunDataCollector:
                var data   = JsonAccess.DeserializeEdges();
                var status = -100;

                if (data == null)
                {
                    return;
                }

                Task.Run(() => status = GoogleAccess.RunDataCollector(data).Result).Wait();

                if (status == 0)
                {
                    JsonAccess.SerializeEdges(data);
                }

                return;

            case OptionTypes.GenerateCsvReport:
                CsvAccess.GenerateCsvReportGroupedByUpdateTime();

                return;

            default:
                return;
            }
        }
Exemple #6
0
        private void StorageBox_Load(object sender, EventArgs e)
        {
            Logger.Debug("[收纳箱界面加载]执行开始");
            GetJsonPath(JsonFileName);

            // 读取json数据存入tpnList里
            TabPageAll tabPageAll = new TabPageAll();

            try
            {
                TabPageAll obj = JsonAccess.ReadJson_TabNames(JsonPath);

                if (obj != null)
                {
                    foreach (TabPageNames item in obj.TabPageNames)
                    {
                        TabPageNames tpn1 = new TabPageNames();
                        tpn1.Name = item.Name;
                        tabPageAll.TabPageNames.Add(tpn1);
                    }
                }
            }
            catch (Exception e1)
            {
                Logger.Error(e1.ToString());
            }

            if (tabPageAll == null || tabPageAll.TabPageNames.Count == 0)
            {
                return;
            }

            foreach (TabPageNames item in tabPageAll.TabPageNames)
            {
                Logger.Debug("开始添加Tab:" + item.Name.Remove(0, 3));
                tabC_ctx.TabPages.Add(item.Name.Remove(0, 3));
            }
            Logger.Debug("[收纳箱界面加载]执行结束");
        }