Exemplo n.º 1
0
        private async void bUpdate_Click(object sender, RoutedEventArgs e)
        {
            TimeSlotsContainer container = (DataContext as TimeSlotsContainer);
            TimeSlot           ts        = container.TimeSlots.First(t => t.Id == current) as TimeSlot;

            BeginTimePicker.Time = new TimeSpan(ts.Beg.AsHours(), 0, 0);
            EndTimePicker.Time   = new TimeSpan(ts.End.AsHours(), 0, 0);
            await ChooseTimeDialog.ShowAsync();
        }
Exemplo n.º 2
0
 private void DeleteTimeSlotCallback(JObject request, JObject response)
 {
     if (response["returnCode"] == null || response["returnCode"].ToObject <UInt64>() == 0)
     {
         TimeSlotsContainer container = (DataContext as TimeSlotsContainer);
         EmptyPlanning();
         container.TimeSlots.RemoveAll(ts => ts.Id == request["id"].ToObject <UInt64>());
         SetPlanning();
     }
     //else
     //    HandleError(response);
 }
Exemplo n.º 3
0
 private void AddTimeSlotCallback(JObject request, JObject response)
 {
     if (response["returnCode"] == null || response["returnCode"].ToObject <UInt64>() == 0)
     {
         TimeSlotsContainer container = (DataContext as TimeSlotsContainer);
         EmptyPlanning();
         container.TimeSlots.Add(new TimeSlot(response["id"].ToObject <UInt64>(),
                                              JsonConvert.DeserializeObject <Time>(request["beg"].ToString()),
                                              JsonConvert.DeserializeObject <Time>(request["end"].ToString())));
         SetPlanning();
     }
     //else
     //    HandleError(response);
 }
Exemplo n.º 4
0
        private void ChooseTimeDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
        {
            TimeSlotsContainer container = (DataContext as TimeSlotsContainer);

            if (current == 0)
            {
                Communication.getInstance.sendFuncs["addTimeSlot"].DynamicInvoke((Action <JObject, JObject>)AddTimeSlotCallback,
                                                                                 container.ProfileId, new Time(container.DayOfWeek, (int)BeginTimePicker.Time.TotalMinutes), new Time(container.DayOfWeek, (int)EndTimePicker.Time.TotalMinutes));
            }
            else
            {
                Communication.getInstance.sendFuncs["updateTimeSlot"].DynamicInvoke((Action <JObject, JObject>)UpdateTimeSlotCallback,
                                                                                    current, new Time(container.DayOfWeek, (int)BeginTimePicker.Time.TotalMinutes), new Time(container.DayOfWeek, (int)EndTimePicker.Time.TotalMinutes));
            }
            //DateTime tmp = GetNextWeekday(DateTime.Now, DayOfWeek.Tuesday);
            //DateTime b = new DateTime(tmp.Year, tmp.Month, tmp.Day, BeginTimePicker.Time.Hours, BeginTimePicker.Time.Minutes, 0);
            //DateTime e = new DateTime(tmp.Year, tmp.Month, tmp.Day, EndTimePicker.Time.Hours, EndTimePicker.Time.Minutes, 0);
            //(DataContext as ObservableCollection<TimeSlot>).Add(new TimeSlot(b.Ticks, e.Ticks));
        }