コード例 #1
0
        void contextMenu_Opened(object sender, RoutedEventArgs e)
        {
            ContextMenu      contextMenu      = borderControl.ContextMenu;
            TimeEntryControl timeEntryControl = GetTimeEntryControl(contextMenu);

            timeEntryControl.TimeOfDay = new TimeSpan(Hour, Minute, 0);
        }
コード例 #2
0
        void contextMenu_Closed(object sender, RoutedEventArgs e)
        {
            ContextMenu      contextMenu      = borderControl.ContextMenu;
            TimeEntryControl timeEntryControl = GetTimeEntryControl(contextMenu);

            if (timeEntryControl.IsOK)
            {
                Hour   = timeEntryControl.TimeOfDay.Hours;
                Minute = timeEntryControl.TimeOfDay.Minutes;
                InvokeTimeChanged();
            }
        }
コード例 #3
0
ファイル: PosDialogWindow.xaml.cs プロジェクト: zaieda/TemPOS
        /*
         * public static PhoneNumber PromptPhoneNumber(string fieldName, PhoneNumber phoneNumber)
         * {
         *  // Todo: PromptPhoneNumber
         *  throw new NotImplementedException();
         * }
         */

        public static TimeSpan?PromptForTime(string fieldName, TimeSpan?timeOfDay)
        {
            TimeEntryControl control = new TimeEntryControl();
            PosDialogWindow  window  = new PosDialogWindow(control, fieldName);

            if (timeOfDay.HasValue)
            {
                control.TimeOfDay = timeOfDay.Value;
            }
            //control.UseMilitaryFormat = true;
            window.IsClosable = false;
            window.Width      = 250;
            window.Height     = 390;
            window.ShowDialogForActiveWindow();
            if (!control.IsOK)
            {
                return(null);
            }
            return(control.TimeOfDay);
        }
コード例 #4
0
 private TimeEntryControl GetTimeEntryControl(
     DependencyObject parentDependencyObject)
 {
     for (int i = 0; i < VisualTreeHelper.GetChildrenCount(parentDependencyObject); i++)
     {
         DependencyObject depObject =
             VisualTreeHelper.GetChild(parentDependencyObject, i);
         if (depObject is TimeEntryControl)
         {
             return(depObject as TimeEntryControl);
         }
         if (VisualTreeHelper.GetChildrenCount(depObject) > 0)
         {
             TimeEntryControl childFound = GetTimeEntryControl(depObject);
             if (childFound != null)
             {
                 return(childFound);
             }
         }
     }
     return(null);
 }
コード例 #5
0
        private void dockPanel_MouseDown(object sender, MouseButtonEventArgs e)
        {
            if (e == lastArgs)
            {
                return;
            }
            lastArgs = e;
            //TimeSpan? time = PromptForTime();

            SetContextMenu();
            ContextMenu      contextMenu      = borderControl.ContextMenu;
            TimeEntryControl timeEntryControl = GetTimeEntryControl(contextMenu);

            timeEntryControl.IsContextMenu = true;
            Border border = GetBorderControl(contextMenu);

            border.BorderBrush     = ConfigurationManager.BorderBrush;
            border.Background      = ConfigurationManager.ApplicationBackgroundBrush;
            border.BorderThickness = new Thickness(1);
            border.CornerRadius    = new CornerRadius(4);
            contextMenu.IsOpen     = true;
            e.Handled = true;
        }