Пример #1
0
        //読み込まれたとき
        protected override void OnAppearing()
        {
            DateTime today  = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
            string   todays = today.ToString("yyyy/MM/dd");

            //keyが格納されているか
            if (Application.Current.Properties.ContainsKey("date"))
            {
                DateTime lastdate = (DateTime)Application.Current.Properties["date"];

                //今日と保存されている日付を比較
                if (!(lastdate == today))
                {
                    //今日まだ
                    Application.Current.Properties["date"] = today;
                    //期限付き
                    if (FoodModel.SelectF_result() != -999 && FoodModel.SelectF_result() > 0)
                    {
                        //DisplayAlert("期限通知", "期限まであと" + SettingModel.SelectSetting_Max().ToString() + "日の食材があります", "OK");
                        DisplayAlert("期限通知", "期限が近づいている食材があります", "OK");
                    }
                }
            }
            else//はじめて
            {
                Application.Current.Properties["date"] = today;
                if (FoodModel.SelectF_result() != -999 && FoodModel.SelectF_result() > 0)
                {
                    DisplayAlert("期限通知", "期限まであと" + SettingModel.SelectSetting_Max().ToString() + "日の食材があります", "OK");
                }
            }
        }
Пример #2
0
        /************************************ここから通知を試すためのセレクトメソッド************************************/
        public static int SelectF_result()
        {
            using (SQLiteConnection db = new SQLiteConnection(App.dbPath))
            {
                try
                {
                    int setting = 100;

                    setting = SettingModel.SelectSetting_Max();

                    List <FoodModel> resultList = db.Query <FoodModel>("SELECT [F_result] FROM [Food] WHERE [F_result] = " + setting);

                    int[] resultArray = new int[100];

                    int result = -999;

                    int i = 0;

                    foreach (FoodModel fdm in resultList)
                    {
                        resultArray[i] = fdm.F_result;
                        i++;
                    }

                    result = resultArray[0];

                    return(result);
                }
                catch (Exception e)
                {
                    System.Diagnostics.Debug.WriteLine(e);
                    return(-999);
                }
            }
        }
Пример #3
0
 /****************通知の試し01(これはタブ切り替えの度にポップアップが出るけどDBの処理はできてる)*************/
 protected override void OnAppearing()
 {
     if (FoodModel.SelectF_result() != null && FoodModel.SelectF_result() > 0 && flug != 1)
     {
         //DisplayAlert("消費期限通知", "期限が近づいている食材があります", "OK");
         DisplayAlert("消費期限通知", "消費期限まであと" + SettingModel.SelectSetting_Max().ToString() + "日の食材があります", "OK");
         flug = 1;
     }
 }
Пример #4
0
        private void Select_Max_Clicked(object sender, EventArgs e)
        {
            select_max = SettingModel.SelectSetting_Max();

            DisplayAlert("最新の通知日数", select_max.ToString(), "OK");
        }