Example #1
0
 private void Tile_box_Checked(object sender, RoutedEventArgs e)
 {
     if (!start_mode)
     {
         //保存数据
         tile_enable = true;
         Data_storage.save_para("tile_enable", true);
     }
 }
Example #2
0
 private void Save_setting_Unchecked(object sender, RoutedEventArgs e)
 {
     if (!start_mode)
     {
         //保存数据
         setting_save = false;
         Data_storage.save_para("setting_save", false);
     }
 }
Example #3
0
 private void Tile_box_Unchecked(object sender, RoutedEventArgs e)
 {
     if (!start_mode)
     {
         //保存数据
         tile_enable = false;
         Data_storage.save_para("tile_enable", false);
         TileNotificationHelper.CleanTileNotification();
     }
 }
Example #4
0
        private async void Page_Loading(FrameworkElement sender, object args)
        {
            start_mode = true;

            if (Data_storage.read_para("setting_save") != null)
            {
                setting_save       = (bool)Data_storage.read_para("setting_save");
                Save_box.IsChecked = setting_save;
            }
            if (Data_storage.read_para("tile_enable") != null)
            {
                tile_enable        = (bool)Data_storage.read_para("tile_enable");
                Tile_box.IsChecked = tile_enable;
            }

            if (!await MainVM.CheckNetwork())
            {
                Button.IsEnabled = false;
                return;
            }
            MainVM.Region_Lists = await myhttp.GetList_region();

            if (setting_save && Data_storage.read_power() != null)
            {
                power_info        = (Power)Data_storage.read_power();
                MainVM.PowerLists = await myhttp.GetPower(power_info);

                if (tile_enable)
                {
                    TileNotificationHelper.UpdateTitleNotification(power_info, MainVM.PowerLists);
                }
                else
                {
                    TileNotificationHelper.CleanTileNotification();
                }

                MainVM.Department_Lists = await myhttp.GetList_dormitory(power_info.region);

                region_box.SelectedIndex     = region_box.Items.IndexOf(power_info.region);
                department_box.SelectedIndex = department_box.Items.IndexOf(power_info.department_num);
                donitory_box.Text            = power_info.domitory_num;
            }
            start_mode = false;
        }
Example #5
0
        private void App_Suspending(object sender, SuspendingEventArgs e)
        {
            if (!Button.IsEnabled)
            {
                return;
            }
            else if (setting_save && MainVM.Message != "该宿舍不存在")
            {
                var region_selection     = (string)region_box.SelectedItem;
                var department_selection = (string)department_box.SelectedItem;
                var domitory_selection   = donitory_box.Text;

                power_info = new Power(region_selection, department_selection, domitory_selection);

                Data_storage.save_power(power_info);
            }
            else
            {
                Data_storage.remove_power();
            }
        }