示例#1
0
        private async Task SavePersistedFlowState(StorageFile file, FlowStateForSerilization flowState)
        {
            string json = "";

            try
            {
                json = JsonHelper.ToJson(flowState, KnownTypes);
                //json = JsonConvert.SerializeObject(flowState);
            }
            catch (Exception)
            {
            }
            await FileIO.WriteTextAsync(file, json);
        }
示例#2
0
        public async Task <FlowState> GetFlowState()
        {
            try
            {
                StorageFile file = await roamingFolder.GetFileAsync(fileName);

                string json = await FileIO.ReadTextAsync(file);

                //FlowStateForSerilization flowSate = JsonConvert.DeserializeObject<FlowStateForSerilization>(json, Settings);
                FlowStateForSerilization flowSate = JsonHelper.FromJson <FlowStateForSerilization>(json, KnownTypes);


                return(new FlowState(flowSate));
            }
            catch (Exception)
            {
                return(null);
            }
        }