Exemplo n.º 1
0
        internal void ChangeStartDatePlan_OnClick(object sender, EventArgs e)
        {
            if (_readonly)
            {
                return;
            }

            DateTime currentStartDate;

            if (!DateTime.TryParse($"{_currentEventRecordset["StartDatePlan"]}",
                                   out currentStartDate))
            {
                Utils.TraceMessage($"uncorrect format date {_currentEventRecordset["StartDatePlan"]}");
                currentStartDate = DateTime.Now;
            }

            Dialog.DateTime(Translator.Translate("select_date"), currentStartDate,
                            (o, args) =>
            {
                _startDatePlanTextView.Text = args.Result.ToString("HH:mm");
                var @event = (Event)DBHelper.LoadEntity($"{_currentEventRecordset["Id"]}");
                if (@event.EndDatePlan != DateTime.MinValue)
                {
                    @event.EndDatePlan = args.Result + (@event.EndDatePlan - @event.StartDatePlan);
                }
                @event.StartDatePlan = args.Result;
                DBHelper.SaveEntity(@event);
                _currentEventRecordset = GetCurrentEvent();
            });
        }
Exemplo n.º 2
0
 private void Ask_Handler(object sender, ResultEventArgs <Dialog.Result> args)
 {
     if (args.Result == Dialog.Result.Yes)
     {
         Console.WriteLine("That's good");
         Dialog.DateTime("What time is is ?", DateTime_Handler);
     }
     else if (args.Result == Dialog.Result.No)
     {
         Console.WriteLine("That's bad");
         Dialog.DateTime("What time is is ?", DateTime_Handler);
     }
 }
Exemplo n.º 3
0
        //TODO: Ввести проверку на то что EndDatePlan > StartDatePlan
        internal void EndDatePlan_OnClick(object sender, EventArgs e)
        {
            var btn = (Button)sender;

            Dialog.DateTime("Выберите дату", DateTime.Now, (o, args) =>
            {
                btn.Text           = $"{args.Result:g}";
                _event.EndDatePlan = args.Result;

                Utils.TraceMessage($"{nameof(_event)}.{nameof(_event.EndDatePlan)}: " +
                                   $"{_event.EndDatePlan}");
            });
        }
Exemplo n.º 4
0
        // Дата
        internal void CheckListDateTime_OnClick(object sender, EventArgs e)
        {
            if (_readonly)
            {
                return;
            }
            _currentCheckListItemID = ((VerticalLayout)sender).Id;
            _textView = (TextView)((VerticalLayout)sender).GetControl(0);
            DateTime date;
            var      isDate = DateTime.TryParse(_textView.Text, out date);

            date = isDate ? date : DateTime.Now;
            Dialog.DateTime(Translator.Translate("select_date"), date, DateCallback);
        }