Esempio n. 1
0
 void schedule_AppointmentEditorOpening(object sender, AppointmentEditorOpeningEventArgs e)
 {
     e.Cancel       = true;
     AddDataContext = new BindingClassWinRT {
         Appointment = e.Appointment, CurrentSelectedDate = e.StartTime
     };
     if (e.Appointment != null)
     {
         EditAppointment();
     }
     else
     {
         AddAppointment();
     }
 }
Esempio n. 2
0
        void Schedule_PopupMenuOpening(object sender, ContextMenuOpeningEventArgs e)
        {
            RadialPopup.IsOpen = false;
            e.Cancel           = true;
            RadialPopup.IsOpen = true;
            radialMenu.IsOpen  = true;
            //double borderBoundX = (e.CurrentEventArgs as TappedRoutedEventArgs).GetPosition(schedule).X + (1.2 * radialMenu.RadiusX);
            //double borderBoundY = (e.CurrentEventArgs as TappedRoutedEventArgs).GetPosition(schedule).Y + (1.2 * radialMenu.RadiusY);
            double borderBoundX = 0.0;
            double borderBoundY = 0.0;

            if (e.CurrentEventArgs is TappedRoutedEventArgs)
            {
                borderBoundX = (e.CurrentEventArgs as TappedRoutedEventArgs).GetPosition(schedule).X + (1.2 * radialMenu.RadiusX);
                borderBoundY = (e.CurrentEventArgs as TappedRoutedEventArgs).GetPosition(schedule).Y + (1.2 * radialMenu.RadiusY);
            }
            else if (e.CurrentEventArgs is HoldingRoutedEventArgs)
            {
                borderBoundX = (e.CurrentEventArgs as HoldingRoutedEventArgs).GetPosition(schedule).X + (1.2 * radialMenu.RadiusX);
                borderBoundY = (e.CurrentEventArgs as HoldingRoutedEventArgs).GetPosition(schedule).Y + (1.2 * radialMenu.RadiusY);
            }
            else if (e.CurrentEventArgs is PointerRoutedEventArgs)
            {
                borderBoundX = (e.CurrentEventArgs as PointerRoutedEventArgs).GetCurrentPoint(schedule).Position.X + (1.2 * radialMenu.RadiusX);
                borderBoundY = (e.CurrentEventArgs as PointerRoutedEventArgs).GetCurrentPoint(schedule).Position.Y + (1.2 * radialMenu.RadiusY);
            }
            if (borderBoundX > (sender as SfSchedule).ActualWidth)
            {
                RadialPopup.HorizontalOffset = borderBoundX - (2.5 * radialMenu.RadiusX);
            }
            else
            {
                if (e.CurrentEventArgs is TappedRoutedEventArgs)
                {
                    RadialPopup.HorizontalOffset = (e.CurrentEventArgs as TappedRoutedEventArgs).GetPosition(schedule).X;
                }
                else if (e.CurrentEventArgs is HoldingRoutedEventArgs)
                {
                    RadialPopup.HorizontalOffset = (e.CurrentEventArgs as HoldingRoutedEventArgs).GetPosition(schedule).X;
                }
                else if (e.CurrentEventArgs is PointerRoutedEventArgs)
                {
                    RadialPopup.HorizontalOffset = (e.CurrentEventArgs as PointerRoutedEventArgs).GetCurrentPoint(schedule).Position.X;
                }
            }
            if (borderBoundY > (sender as SfSchedule).ActualHeight)
            {
                RadialPopup.VerticalOffset = borderBoundY - (2.5 * radialMenu.RadiusY);
            }
            else
            {
                if (e.CurrentEventArgs is TappedRoutedEventArgs)
                {
                    RadialPopup.VerticalOffset = (e.CurrentEventArgs as TappedRoutedEventArgs).GetPosition(schedule).Y;
                }
                else if (e.CurrentEventArgs is HoldingRoutedEventArgs)
                {
                    RadialPopup.VerticalOffset = (e.CurrentEventArgs as HoldingRoutedEventArgs).GetPosition(schedule).Y;
                }
                else if (e.CurrentEventArgs is PointerRoutedEventArgs)
                {
                    RadialPopup.VerticalOffset = (e.CurrentEventArgs as PointerRoutedEventArgs).GetCurrentPoint(schedule).Position.Y;
                }
            }

            if (e.CurrentSelectedDate != null)
            {
                this.CurrentSelectedDate = (DateTime)e.CurrentSelectedDate;
            }
            AddDataContext = new BindingClassWinRT {
                Appointment = e.Appointment, CurrentSelectedDate = e.CurrentSelectedDate
            };

            if (e.Appointment != null)
            {
                for (int i = 0; i < radialMenu.Items.Count; i++)
                {
                    if (i == 3 && copiedAppointment == null)
                    {
                        (radialMenu.Items[i] as SfRadialMenuItem).IsEnabled = false;
                        (radialMenu.Items[i] as SfRadialMenuItem).Opacity   = 0.5;
                    }
                    else
                    {
                        (radialMenu.Items[i] as SfRadialMenuItem).IsEnabled = true;
                        (radialMenu.Items[i] as SfRadialMenuItem).Opacity   = 1;
                    }
                }
            }
            else
            {
                (radialMenu.Items[1] as SfRadialMenuItem).IsEnabled = false;
                (radialMenu.Items[1] as SfRadialMenuItem).Opacity   = 0.5;
                (radialMenu.Items[2] as SfRadialMenuItem).IsEnabled = false;
                (radialMenu.Items[2] as SfRadialMenuItem).Opacity   = 0.5;
                (radialMenu.Items[5] as SfRadialMenuItem).IsEnabled = false;
                (radialMenu.Items[5] as SfRadialMenuItem).Opacity   = 0.5;
                (radialMenu.Items[0] as SfRadialMenuItem).IsEnabled = true;
                if (copiedAppointment != null)
                {
                    (radialMenu.Items[3] as SfRadialMenuItem).IsEnabled = true;
                    (radialMenu.Items[3] as SfRadialMenuItem).Opacity   = 1;
                }
                else
                {
                    (radialMenu.Items[3] as SfRadialMenuItem).IsEnabled = false;
                    (radialMenu.Items[3] as SfRadialMenuItem).Opacity   = 0.5;
                }
            }
        }