Exemple #1
0
 public static void DeserializeConfiguration(FileData fileData, PromptPageState promptPageState)
 {
     try
     {
         string json = System.IO.File.ReadAllText(fileData.FilePath).Replace("\r\n", string.Empty).Replace("\t", string.Empty).Replace("  ", String.Empty);;
         json = Regex.Unescape(json).Replace(@"\s+", "");
         var configuration = JsonConvert.DeserializeObject <Configuration>(json);
         if (configuration != null)
         {
             AiDataStore.SaveConfiguration(configuration);
             App.Current.MainPage = new SignIn();
         }
     }
     catch (Exception ex)
     {
         Log.Warning("Configuration Deserialization Exception", ex.StackTrace);
         Task.Run(async() => await PopupNavigation.Instance.PushAsync(new MessageBox("Your configuration has an issue, please load another one to proceed", MessageType.Configuration, promptPageState)));
     }
 }
Exemple #2
0
 public void Init()
 {
     try
     {
         user          = AiDataStore.GetUser();
         configuration = AiDataStore.GetConfiguration();
         if (configuration != null && user != null)
         {
             StartApplication();
         }
         else
         {
             App.Current.MainPage = new NavigationPage(new Init());
         }
     }
     catch (Exception ex)
     {
         Task.Run(async() => await PopupNavigation.Instance.PushAsync(new MessageBox(ex.StackTrace, MessageType.Regular, this)));
     }
 }