Пример #1
0
        public override StartCommandResult OnStartCommand(Intent intent, StartCommandFlags flags, int startId)
        {
            if (isStarted)
            {
                foreach (var data in SQLLiteDB.ReadUserScheduleData())
                {
                    if (data.IsNotify == false && data.Time < DateTime.Now.AddMinutes(15))
                    {
                        //   CrossLocalNotifications.Current.Show(data.Message, DateTime.Now.ToString(), data.Id, DateTime.Now);

                        var manager = (NotificationManager)GetSystemService(NotificationService);

                        if (Build.VERSION.SdkInt >= Android.OS.BuildVersionCodes.O)
                        {
                            var notification = new Notification.Builder(this, "DE")
                                               .SetContentTitle(DateTime.Now.ToString() + "알림!")
                                               .SetContentText(data.Message)
                                               .SetSmallIcon(Resource.Drawable.xamagonBlue)
                                               .SetLargeIcon(BitmapFactory.DecodeResource(Resources, Resource.Drawable.xamagonBlue))
                                               .SetSmallIcon(Resource.Drawable.xamagonBlue)
                                               .Build();

                            manager.Notify(data.Id, notification);
                        }
                        else
                        {
                            var notification = new Notification.Builder(this)
                                               .SetContentTitle(DateTime.Now.ToString() + "알림!")
                                               .SetContentText(data.Message)
                                               .SetSmallIcon(Resource.Drawable.xamagonBlue)
                                               .SetLargeIcon(BitmapFactory.DecodeResource(Resources, Resource.Drawable.xamagonBlue))
                                               .SetSmallIcon(Resource.Drawable.xamagonBlue)
                                               .Build();

                            manager.Notify(data.Id, notification);
                        }

                        //Notify update
                        data.IsNotify = true;
                        SQLLiteDB.Upsert(data, false);
                    }
                }
            }
            else
            {
                RegisterForegroundService();
                isStarted = true;
            }

            SQLLiteDB.InsertScheduleLog(DateTime.Now);

            AlarmReceiver.AddAlarmEvent(10);

            return(StartCommandResult.Sticky);
        }
Пример #2
0
        async void OnScheduleSaveButtonClicked(object sender, EventArgs args)
        {
            //하나씩 저장
            if (FocusButton != null)
            {
                DateTime saveDateTime = new DateTime(ViewModel.CurrentDateTime.Year, ViewModel.CurrentDateTime.Month, Convert.ToInt32(FocusButton.Text), timePicker1.Time.Hours, timePicker1.Time.Minutes, timePicker1.Time.Seconds);

                UserScheduleData saveShedulData = new UserScheduleData();
                saveShedulData.Time    = saveDateTime;
                saveShedulData.Message = ScheduleEdit.Text;
                SQLLiteDB.Upsert(saveShedulData);

                scheduleView.Add(new ScheduleViewItem {
                    Id = saveShedulData.Id, Display = Helper.DateTimeToShortTime(saveDateTime) + " " + ScheduleEdit.Text
                });

                FocusButton.BackgroundColor = Color.White;
                FocusButton       = null;
                ScheduleEdit.Text = string.Empty;
                timePicker1.Time  = new TimeSpan(12, 0, 0);
            }
            else //범위로 저장
            {
                DateTime current = RangeFrom.Date;
                while (true)
                {
                    DateTime saveDateTime = new DateTime(current.Year, current.Month, current.Day, timePicker1.Time.Hours, timePicker1.Time.Minutes, timePicker1.Time.Seconds);

                    UserScheduleData saveShedulData = new UserScheduleData();
                    saveShedulData.Time    = saveDateTime;
                    saveShedulData.Message = ScheduleEdit.Text;
                    SQLLiteDB.Upsert(saveShedulData);

                    current = current.AddDays(1);

                    if (current > RangeUntil.Date)
                    {
                        break;
                    }
                }

                ClearCalendarButtonColor(Color.White);

                RangeStackLayout.IsVisible = false;
                ScheduleGrid.IsVisible     = false;
            }
        }
Пример #3
0
        public Setting()
        {
            InitializeComponent();

            TextSizeSlider.Value = User.CacheData.FontSize;

            TextSizeSlider.ValueChanged += (sender, args) =>
            {
                var newStep = Math.Round(args.NewValue / StepValue);

                Slider SliderMain = sender as Slider;

                SliderMain.Value = newStep * StepValue;

                User.CacheData.FontSize = (int)args.NewValue;

                TextSizeLabel.FontSize = (int)args.NewValue;

                SQLLiteDB.Upsert(User.CacheData);
            };


            KJVOption.IsToggled = User.CacheData.EnalbeKJV;

            MessagingCenter.Subscribe <Setting, CompletePacket>(this, "setting", (s, e) =>
            {
                LOGIN_RES res = new LOGIN_RES();
                res           = LOGIN_RES.Parser.ParseFrom(e.Data);

                messageLabel.Text = res.VarCode.ToString();
            });

            usernameEntry.Focus();

            //이미 로그인 중이면 메세지 표시를 변경
            if (NetProcess.IsSuccessAuth == true)
            {
                messageLabel.Text     = "접속중";
                usernameEntry.Text    = NetProcess.UserId;
                loginbutton.IsVisible = false;
            }
        }
Пример #4
0
 void OnToggledKJV(object sender, ToggledEventArgs e)
 {
     User.CacheData.EnalbeKJV = e.Value;
     SQLLiteDB.Upsert(User.CacheData);
 }
Пример #5
0
        public SettingView()
        {
            InitializeComponent();

            vm.BtnMessage = "Login";
            vm.Version    = "Newest version";

            {
                var currentVersion = VersionTracking.CurrentVersion;

                double myversion = 0;
                double.TryParse(currentVersion, out myversion);
                const Double Eps = 0.000000000000001;

                if (Math.Abs(User.Version - myversion) > Eps)
                {
                    vm.Version = "Updatable";
                }
            }

            TextSizeSlider.Value = User.CacheData.FontSize;

            TextSizeSlider.ValueChanged += (sender, args) =>
            {
                var newStep = Math.Round(args.NewValue / StepValue);

                Slider SliderMain = sender as Slider;

                SliderMain.Value = newStep * StepValue;

                User.CacheData.FontSize = (int)args.NewValue;

                TextSizeLabel.FontSize = (int)args.NewValue;

                SQLLiteDB.Upsert(User.CacheData);

                Device.BeginInvokeOnMainThread(() =>
                {
                    User.OnceVersionNotify = true;
                    DependencyService.Get <Toast>().Notification("New Version Updated");
                });
            };

            KJVOption.IsToggled = User.CacheData.EnalbeKJV;

            usernameEntry.Focus();

            //이미 로그인 중이면 메세지 표시를 변경
            if (User.LoginSuccess == true)
            {
                Device.BeginInvokeOnMainThread(() =>
                {
                    messageLabel.Text  = "Conncted";
                    usernameEntry.Text = User.CacheData.UserName;
                    passwordEntry.Text = "****";

                    vm.BtnMessage = "Conncted";
                });
            }

            BindingContext = vm;
        }