Ejemplo n.º 1
0
    public static IEnumerator PlayGameCoroutine()
    {
        yield return(new WaitForSeconds(0.5f));

        ClassManager.Clear();
        SceneManager.LoadScene("MainScene");
        SceneManager.LoadScene("UIScene", LoadSceneMode.Additive);
    }
Ejemplo n.º 2
0
        public async void ResetData(object sender, RoutedEventArgs args)
        {
            MessageDialog dialog = new MessageDialog(UIManager.Rl.GetString("SettingResetDataWarning"));

            dialog.Commands.Add(new UICommand(UIManager.Rl.GetString("SettingResetDataWarningConfirm"), new UICommandInvokedHandler(async(IUICommand cmd) =>
            {
                try
                {
                    await sManager.Clear();
                    await cManager.Clear();
                } catch
                {
                }
            })));
            dialog.Commands.Add(new UICommand(UIManager.Rl.GetString("SettingResetDataWarningCancel")));
            await dialog.ShowAsync();
        }
Ejemplo n.º 3
0
        public async Task LoadData(StorageFile from)
        {
            JObject      root    = JObject.Parse(await FileIO.ReadTextAsync(from));
            JArray       classes = (JArray)root.GetValue("Classroom");
            JArray       sches   = (JArray)root.GetValue("Schedule");
            ClassManager cM      = new ClassManager();
            ScheManager  sM      = new ScheManager();
            string       dbpath  = Path.Combine(ApplicationData.Current.LocalFolder.Path, ClassManager.DB_FILE);

            using (SqliteConnection db = new SqliteConnection($"Filename={dbpath}"))
            {
                await db.OpenAsync();

                SqliteTransaction transC = db.BeginTransaction();
                try
                {
                    await cM.Clear(db, transC);

                    foreach (JObject o in classes)
                    {
                        await cM.AddData(new ClassObj()
                        {
                            Order  = (long)o.GetValue("Order"),
                            Link   = o.GetValue("Link").ToString(),
                            DisTxt = o.GetValue("Txt").ToString()
                        }, db, transC);
                    }
                }
                catch (Exception e)
                {
                    transC.Rollback();
                    throw e;
                }
                transC.Commit();
            }

            dbpath = Path.Combine(ApplicationData.Current.LocalFolder.Path, ScheManager.DB_FILE);
            using (SqliteConnection db = new SqliteConnection($"Filename={dbpath}"))
            {
                await db.OpenAsync();

                SqliteTransaction transS = db.BeginTransaction();
                try
                {
                    await sM.Clear(db, transS);

                    foreach (JObject o in sches)
                    {
                        await sM.Insert(new ScheData()
                        {
                            Content  = o.GetValue("Cont").ToString(),
                            Complete = (long)o.GetValue("Txt") == 1 ? true : false,
                            Time     = DateTimeOffset.ParseExact(o.GetValue("Date").ToString(), "yyyy/MM/dd", new CultureInfo("ko-KR"))
                        }, db, transS);
                    }
                }
                catch (Exception e)
                {
                    transS.Rollback();
                    throw e;
                }
                transS.Commit();
            }
        }