Exemple #1
0
        /// <summary>
        /// Clears any existing selection and then selects the current element.
        /// </summary>
        void ISelectionItemProvider.Select()
        {
            CalendarButton button = OwningCalendarButton;

            if (!button.IsEnabled)
            {
                throw new ElementNotEnabledException();
            }

            Calendar calendar = OwningCalendar;

            if (calendar != null &&
                button.Visibility != Visibility.Collapsed &&
                !button.IsCalendarButtonFocused)
            {
                foreach (CalendarButton child in calendar.MonthControl.YearView.Children)
                {
                    if (child.IsCalendarButtonFocused)
                    {
                        child.IsCalendarButtonFocused = false;
                        break;
                    }
                }

                button.IsCalendarButtonFocused = true;
            }
        }
        private void MoveRight(int idx)
        {
            //Check out of bounds
            if (idx < 0 || idx >= DateFormat.Length)
            {
                return;
            }

            //DateFormat char that we start with
            char first = DateFormat[idx];

            //Next character index
            int next = idx + 1;

            //Keep moving right until a new DateFormat letter is found or next is out of bounds
            int max = DateFormat.Length;

            while (next < max && (DateFormat[next] == first || !Char.IsLetter(DateFormat[next])))
            {
                next++;
            }

            if (next == max)
            {
                CalendarButton.Focus();
            }
            else
            {
                SelDateComponent(next);
            }
        }
Exemple #3
0
 void ReleaseDesignerOutlets()
 {
     if (CalendarButton != null)
     {
         CalendarButton.Dispose();
         CalendarButton = null;
     }
     if (CommunityButton != null)
     {
         CommunityButton.Dispose();
         CommunityButton = null;
     }
     if (NutritionButton != null)
     {
         NutritionButton.Dispose();
         NutritionButton = null;
     }
     if (ProfileButton != null)
     {
         ProfileButton.Dispose();
         ProfileButton = null;
     }
     if (WorkoutsButton != null)
     {
         WorkoutsButton.Dispose();
         WorkoutsButton = null;
     }
 }
Exemple #4
0
        /// <summary>
        /// Returns the text label of the CalendarButton that is associated with
        /// this CalendarButtonAutomationPeer. This method is called by GetName.
        /// </summary>
        /// <returns>
        /// The text label of the element that is associated with this
        /// automation peer.
        /// </returns>
        /// <remarks>
        /// The name property can be thought of as the string of text that a
        /// user would use to explain which control is being referred to.  It is
        /// important to have a textual representation for all controls in the
        /// graphical user interface (GUI) so that you can programmatically
        /// refer to the control in a localized manner.  The value is settable
        /// on control instances through the AutomationProperties.Name attached
        /// property.
        /// </remarks>
        protected override string GetNameCore()
        {
            string name = base.GetNameCore();

            if (string.IsNullOrEmpty(name))
            {
                AutomationPeer labeledBy = GetLabeledByCore();
                if (labeledBy != null)
                {
                    name = labeledBy.GetName();
                }

                CalendarButton button = this.OwningCalendarButton;
                if (string.IsNullOrEmpty(name) && button != null)
                {
                    if (button.DataContext is DateTime)
                    {
                        if (this.OwningCalendar.DisplayMode == CalendarMode.Decade)
                        {
                            name = DateTimeHelper.ToYearString((DateTime)button.DataContext);
                        }
                        else
                        {
                            name = DateTimeHelper.ToYearMonthPatternString((DateTime)button.DataContext);
                        }
                    }
                    else if (button.Content != null)
                    {
                        name = string.Format(DateTimeHelper.GetCurrentDateFormat(), button.Content.ToString());
                    }
                }
            }
            return(name);
        }
 void ReleaseDesignerOutlets()
 {
     if (CalendarButton != null)
     {
         CalendarButton.Dispose();
         CalendarButton = null;
     }
     if (FavoritesButton != null)
     {
         FavoritesButton.Dispose();
         FavoritesButton = null;
     }
     if (NavBar != null)
     {
         NavBar.Dispose();
         NavBar = null;
     }
     if (NutritionButton != null)
     {
         NutritionButton.Dispose();
         NutritionButton = null;
     }
     if (ProfileButton != null)
     {
         ProfileButton.Dispose();
         ProfileButton = null;
     }
     if (WorkoutsButton != null)
     {
         WorkoutsButton.Dispose();
         WorkoutsButton = null;
     }
 }
Exemple #6
0
    void Start()
    {
        calendarManager = FindObjectOfType <CalendarManager> ();
        calendarButton  = FindObjectOfType <CalendarButton> ();

        StartCoroutine("Access");               //コルーチン
    }
 public void Select()
 {
     if (cuttentlySelected != this)
     {
         selectImage.enabled = true;
         if (cuttentlySelected != null)
         {
             cuttentlySelected.Deselect();
         }
         cuttentlySelected = this;
     }
 }
Exemple #8
0
        /// <summary>
        /// Returns the string that describes the functionality of the
        /// CalendarButton that is associated with this
        /// CalendarButtonAutomationPeer.  This method is called by GetHelpText.
        /// </summary>
        /// <returns>
        /// The help text, or String.Empty if there is no help text.
        /// </returns>
        protected override string GetHelpTextCore()
        {
            CalendarButton button = OwningCalendarButton;

            if (button != null && button.DataContext != null && button.DataContext is DateTime)
            {
                DateTime dataContext = (DateTime)OwningCalendarButton.DataContext;

                return(dataContext.Date.ToString(DateTimeHelper.GetCurrentDateFormat().LongDatePattern, DateTimeHelper.GetCurrentDateFormat()));
            }

            return(base.GetHelpTextCore());
        }
 public static IObservable <EventPattern <MouseButtonEventArgs> > MouseDownObserver(this CalendarButton This)
 {
     return(Observable.FromEventPattern <MouseButtonEventHandler, MouseButtonEventArgs>(h => This.MouseDown += h, h => This.MouseDown -= h));
 }
 public static IObservable <EventPattern <ContextMenuEventArgs> > ContextMenuClosingObserver(this CalendarButton This)
 {
     return(Observable.FromEventPattern <ContextMenuEventHandler, ContextMenuEventArgs>(h => This.ContextMenuClosing += h, h => This.ContextMenuClosing -= h));
 }
 public static IObservable <EventPattern <ToolTipEventArgs> > ToolTipClosingObserver(this CalendarButton This)
 {
     return(Observable.FromEventPattern <ToolTipEventHandler, ToolTipEventArgs>(h => This.ToolTipClosing += h, h => This.ToolTipClosing -= h));
 }
 public static IObservable <EventPattern <RoutedEventArgs> > UnloadedObserver(this CalendarButton This)
 {
     return(Observable.FromEventPattern <RoutedEventHandler, RoutedEventArgs>(h => This.Unloaded += h, h => This.Unloaded -= h));
 }
 public static IObservable <EventPattern <RequestBringIntoViewEventArgs> > RequestBringIntoViewObserver(this CalendarButton This)
 {
     return(Observable.FromEventPattern <RequestBringIntoViewEventHandler, RequestBringIntoViewEventArgs>(h => This.RequestBringIntoView += h, h => This.RequestBringIntoView -= h));
 }
Exemple #14
0
 /// <summary>
 /// Initializes a new instance of the
 /// <see cref="T:WinRTXamlToolkit.Automation.Peers.CalendarButtonAutomationPeer" />
 /// class.
 /// </summary>
 /// <param name="owner">
 /// The
 /// <see cref="T:WinRTXamlToolkit.Controls.Primitives.CalendarButton" />
 /// to associate with this
 /// <see cref="T:WinRTXamlToolkit.Automation.Peers.AutomationPeer" />.
 /// </param>
 public CalendarButtonAutomationPeer(CalendarButton owner)
     : base(owner)
 {
 }
 public static IObservable <EventPattern <QueryContinueDragEventArgs> > QueryContinueDragObserver(this CalendarButton This)
 {
     return(Observable.FromEventPattern <QueryContinueDragEventHandler, QueryContinueDragEventArgs>(h => This.QueryContinueDrag += h, h => This.QueryContinueDrag -= h));
 }
 public static IObservable <EventPattern <DependencyPropertyChangedEventArgs> > FocusableChangedObserver(this CalendarButton This)
 {
     return(Observable.FromEventPattern <DependencyPropertyChangedEventHandler, DependencyPropertyChangedEventArgs>(h => This.FocusableChanged += h, h => This.FocusableChanged -= h));
 }
 public static IObservable <EventPattern <EventArgs> > InitializedObserver(this CalendarButton This)
 {
     return(Observable.FromEventPattern <EventHandler, EventArgs>(h => This.Initialized += h, h => This.Initialized -= h));
 }
 public static IObservable <EventPattern <RoutedEventArgs> > LostFocusObserver(this CalendarButton This)
 {
     return(Observable.FromEventPattern <RoutedEventHandler, RoutedEventArgs>(h => This.LostFocus += h, h => This.LostFocus -= h));
 }
 public static IObservable <EventPattern <SizeChangedEventArgs> > SizeChangedObserver(this CalendarButton This)
 {
     return(Observable.FromEventPattern <SizeChangedEventHandler, SizeChangedEventArgs>(h => This.SizeChanged += h, h => This.SizeChanged -= h));
 }
 public static IObservable <EventPattern <TouchEventArgs> > TouchLeaveObserver(this CalendarButton This)
 {
     return(Observable.FromEventPattern <EventHandler <TouchEventArgs>, TouchEventArgs>(h => This.TouchLeave += h, h => This.TouchLeave -= h));
 }
 public static IObservable <EventPattern <TouchEventArgs> > PreviewTouchUpObserver(this CalendarButton This)
 {
     return(Observable.FromEventPattern <EventHandler <TouchEventArgs>, TouchEventArgs>(h => This.PreviewTouchUp += h, h => This.PreviewTouchUp -= h));
 }
 public static IObservable <EventPattern <MouseButtonEventArgs> > PreviewMouseUpObserver(this CalendarButton This)
 {
     return(Observable.FromEventPattern <MouseButtonEventHandler, MouseButtonEventArgs>(h => This.PreviewMouseUp += h, h => This.PreviewMouseUp -= h));
 }
Exemple #23
0
        private void DrawMonthAsCalendar(int year, int month)
        {
            int offset = (int)(GetTheFirstDayOfMonth(new DateTime(year, month, 1)));

            if (offset == 0) //ošetření sunday == 0 => offset = 6
            {
                offset = 6;
            }
            else
            {
                offset -= 1;
            }
            for (int i = 0; i < DateTime.DaysInMonth(year, month); i++)
            {
                DateTime      today           = new DateTime(year, month, i + 1);
                Color         backgroundColor = SelectBackgroundColor(today);
                TableItemUcVm item            = null;
                if (TableUcVm.SavedRecordList?.Count > 0)
                {
                    foreach (TableItemUcVm tableItem in TableUcVm.SavedRecordList)
                    {
                        if (tableItem?.Record?.Date.Year == today.Year &&
                            tableItem?.Record?.Date.Month == today.Month &&
                            tableItem?.Record?.Date.Day == today.Day)
                        {
                            item            = tableItem;
                            backgroundColor = tableItem?.Record?.Type == ERecordType.Vacation ? Color.DarkOrange : Color.Green;
                            if (tableItem?.Record?.Type == ERecordType.Hours)
                            {
                                if (((IHoursRecord)tableItem.Record).OverTime != new WorkTime(0, 0))
                                {
                                    backgroundColor = Color.LightBlue;
                                }
                            }

                            break;
                        }
                    }
                }
                if (today.Year == DateTime.Today.Year && today.Month == DateTime.Today.Month &&
                    today.Day == DateTime.Today.Day)
                {
                    backgroundColor = Color.Gold;
                }
                CalendarButton butt = new CalendarButton()
                {
                    Text            = (i + 1).ToString(),
                    BackgroundColor = backgroundColor,
                    Item            = item
                };
                if (item != null)
                {
                    butt.Command = new Command(() => item.MoreInformationRecord(butt.Item));
                }
                else
                {
                    butt.Command = new Command(() => ChangeTabToAddRecordAndSetupDate(today));
                }
                _grid.Children.Add(butt, (i + offset) % 7, (i + offset) / 7 + 1);
            }
        }
 public static IObservable <EventPattern <DragEventArgs> > PreviewDragLeaveObserver(this CalendarButton This)
 {
     return(Observable.FromEventPattern <DragEventHandler, DragEventArgs>(h => This.PreviewDragLeave += h, h => This.PreviewDragLeave -= h));
 }
Exemple #25
0
    void InitLayout()
    {
        DateTime currentTime = DateTime.Now;

        // add date label - first row
        for (int i = 0; i < 7; i++)
        {
            UILabel lb = new UILabel();
            lb.Frame              = new CoreGraphics.CGRect(i * _itemSize, 0, _itemSize, _itemSize);
            lb.Text               = Constants.DaysInWeek.ElementAt(i);
            lb.TextAlignment      = UITextAlignment.Center;
            lb.ClipsToBounds      = true;
            lb.Layer.CornerRadius = _itemSize / 2;
            lb.BackgroundColor    = _labelColor;
            lb.Layer.BorderWidth  = 1;
            lb.Layer.BorderColor  = UIColor.Black.CGColor;
            this.AddSubview(lb);
        }
        // add month
        UILabel lbMonth = new UILabel();

        lbMonth.Frame         = new CoreGraphics.CGRect(0, _itemSize, this.Bounds.Width, 70);
        lbMonth.TextAlignment = UITextAlignment.Center;
        lbMonth.TextColor     = UIColor.Black;
        lbMonth.Font          = UIFont.BoldSystemFontOfSize(22);
        Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
        string[] monthNames =
            System.Globalization.CultureInfo.CurrentCulture
            .DateTimeFormat.MonthGenitiveNames;

        lbMonth.Text = string.Format("{0} {1}", monthNames[currentTime.Month], currentTime.Year);
        this.AddSubview(lbMonth);
        // draw the table
        UIView viewTable = new UIView();

        viewTable.BackgroundColor = UIColor.Clear;
        viewTable.Frame           = new CoreGraphics.CGRect(0, _itemSize + 70, this.Bounds.Width, _itemSize * _numberRows);
        _buttons = new List <CalendarButton> ();
        for (int row = 0; row < _numberRows; row++)
        {
            for (int col = 0; col < _numberItemPerRow; col++)
            {
                CalendarButton btn = new CalendarButton();
                btn.Frame              = new CoreGraphics.CGRect(col * _itemSize, row * _itemSize, _itemSize, _itemSize);
                btn.BackgroundColor    = UIColor.White;              // default color;
                btn.Layer.BorderColor  = UIColor.Black.CGColor;
                btn.Layer.BorderWidth  = 1;
                btn.Layer.CornerRadius = _itemSize / 2;
                btn.Tag = 0;
                btn.SetTitleColor(UIColor.Black, UIControlState.Normal);
                _buttons.Add(btn);
                viewTable.AddSubview(btn);
            }
        }
        // get the first and last date of current month;
        DateTime nexMonth          = currentTime.AddMonths(1);
        var      startDate         = new DateTime(nexMonth.Year, nexMonth.Month, 1);
        var      endDate           = startDate.AddMonths(1).AddDays(-1);
        int      currentDateOfWeek = (int)startDate.Date.DayOfWeek;

        for (int i = 0; i < endDate.Day; i++)
        {
            CalendarButton btn = _buttons.ElementAt(currentDateOfWeek + i);
            btn.BackgroundColor = _labelColor;
            btn.SetTitle((i + 1).ToString(), UIControlState.Normal);
            btn.ID             = i + 1;
            btn.TouchUpInside += (object sender, EventArgs e) => {
                CalendarButton sd = (CalendarButton)sender;
                sd.Tag++;
                if (sd.Tag % 3 == 0)
                {
                    // gray
                    sd.State           = 0;
                    sd.BackgroundColor = _labelColor;
                }
                else if (sd.Tag % 3 == 1)
                {
                    // red
                    sd.State           = 1;
                    sd.BackgroundColor = _oneTouchColor;
                }
                else
                {
                    // green
                    sd.State           = 2;
                    sd.BackgroundColor = _twoTouchColor;
                }
            };
        }
        this.AddSubview(viewTable);
    }
 public static IObservable <EventPattern <GiveFeedbackEventArgs> > GiveFeedbackObserver(this CalendarButton This)
 {
     return(Observable.FromEventPattern <GiveFeedbackEventHandler, GiveFeedbackEventArgs>(h => This.GiveFeedback += h, h => This.GiveFeedback -= h));
 }
 public static IObservable <EventPattern <ManipulationCompletedEventArgs> > ManipulationCompletedObserver(this CalendarButton This)
 {
     return(Observable.FromEventPattern <EventHandler <ManipulationCompletedEventArgs>, ManipulationCompletedEventArgs>(h => This.ManipulationCompleted += h, h => This.ManipulationCompleted -= h));
 }
 public static IObservable <EventPattern <DragEventArgs> > DropObserver(this CalendarButton This)
 {
     return(Observable.FromEventPattern <DragEventHandler, DragEventArgs>(h => This.Drop += h, h => This.Drop -= h));
 }
 public static IObservable <EventPattern <ManipulationInertiaStartingEventArgs> > ManipulationInertiaStartingObserver(this CalendarButton This)
 {
     return(Observable.FromEventPattern <EventHandler <ManipulationInertiaStartingEventArgs>, ManipulationInertiaStartingEventArgs>(h => This.ManipulationInertiaStarting += h, h => This.ManipulationInertiaStarting -= h));
 }
 public static IObservable <EventPattern <ManipulationBoundaryFeedbackEventArgs> > ManipulationBoundaryFeedbackObserver(this CalendarButton This)
 {
     return(Observable.FromEventPattern <EventHandler <ManipulationBoundaryFeedbackEventArgs>, ManipulationBoundaryFeedbackEventArgs>(h => This.ManipulationBoundaryFeedback += h, h => This.ManipulationBoundaryFeedback -= h));
 }