예제 #1
0
        public async Task<bool> SaveProjectModule(int curproject, int curmodule)
        {
            bool retValue = false;
            WinAppLibrary.Utilities.Helper helper = new WinAppLibrary.Utilities.Helper();

            try
            {
                var projects = this.GetAllProject();
                var modules = this.GetAllModule();

                //Save project
                var xmlstream = helper.EncryptHashSerializeTo<List<DataItem>>(projects);
                await helper.SaveFileStream(ContentPath.OffModeFolder, Lib.ContentPath.ProjectSource, xmlstream);

                //Save Module
                xmlstream = helper.EncryptHashSerializeTo<List<DataItem>>(modules);
                await helper.SaveFileStream(ContentPath.OffModeFolder, Lib.ContentPath.ModuleSource, xmlstream);

                WinAppLibrary.Utilities.Helper.SetValueInStorage(Lib.HashKey.Key_Project, curproject);
                WinAppLibrary.Utilities.Helper.SetValueInStorage(Lib.HashKey.Key_Module, curmodule);
            }
            catch (Exception e)
            {
                helper.ExceptionHandler(e, "SaveProjectModule");
                throw e;
            }

            return retValue;
        }