示例#1
0
        public void setCalendarDay(DateTime date)
        {
            MonthCalendar _calendar = leftArea.MonthCalendar;

            _calendar.SelectionStart = date;
            _calendar.SelectionEnd   = date;
        }
示例#2
0
        public void ClickCalendar(DateTime date)
        {
            MonthCalendar _calendar = leftArea.MonthCalendar;

            if (!_calendar.BoldedDates.Contains(date.Date))
            {
                return;
            }

            postsArea.PostsList.ScrollToDay(date.Date);
        }
 public CalendarContainer()
 {
     // 初期化
     InitializeComponent();
     monthCalendar = new CustomControls.MonthCalendar();
     monthCalendar.CalendarDimensions = new System.Drawing.Size(4, 3);
     monthCalendar.Location           = new System.Drawing.Point(0, 25);
     monthCalendar.Font = new System.Drawing.Font("MS UI Gothic", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
     // added by YAMA 2014/10/20    マネージャ内部時刻同期
     //monthCalendar.ViewStart = new DateTime(DateTime.Now.Year, 1, 1);
     monthCalendar.ViewStart = new DateTime((DBUtil.GetSysTime()).Year, 1, 1);
     this.winForm.Child      = monthCalendar;
 }
        /// <summary>
        /// Edits the specified object's value using the editor style indicated by the
        /// <see cref="UITypeEditor"/><c>.GetEditStyle()</c> method.
        /// </summary>
        /// <param name="context">An <see cref="ITypeDescriptorContext"/> that can be used to gain
        /// additional context information.</param>
        /// <param name="provider">An <see cref="IServiceProvider"/> that this editor can use to obtain services.</param>
        /// <param name="value">The object to edit.</param>
        /// <returns>The new value of the object. If the value of the object has not changed,
        /// this should return the same object it was passed.</returns>
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            this.editorSvc = null;

            if (context != null && context.Instance != null && provider != null && value is BoldedDate)
            {
                var boldedDate = (BoldedDate)value;

                this.editorSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));

                if (this.editorSvc != null)
                {
                    CustomControls.MonthCalendar cal = context.Instance.GetType() == typeof(CustomControls.MonthCalendar)
                                                     ? (CustomControls.MonthCalendar)context.Instance
                                                     : ((DatePicker)context.Instance).Picker;

                    if (cal != null && cal.BoldedDateTypeCollection.Count != 0)
                    {
                        this.calendarListBox.Items.Clear();

                        this.calendarListBox.Items.AddRange(cal.BoldedDateTypeCollection.Cast <object>().ToArray());

                        if (!boldedDate.Type.IsEmpty)
                        {
                            this.calendarListBox.SelectedItem = boldedDate.Type;
                        }

                        this.editorSvc.DropDownControl(this.calendarListBox);

                        if (this.calendarListBox.SelectedItem != null)
                        {
                            return(((BoldedDate)this.calendarListBox.SelectedItem).Type);
                        }

                        return(cal.BoldedDateTypeCollection[0]);
                    }
                }
            }

            return(null);
        }
示例#5
0
        private void setCalendarBoldedDates(List <Post> posts)
        {
            MonthCalendar _mc = leftArea.MonthCalendar;

            _mc.SuspendLayout();

            _mc.BoldedDates.Clear();

            foreach (Post _p in posts)
            {
                DateTime _dt = DateTimeHelp.ISO8601ToDateTime(_p.timestamp);

                if (!_mc.BoldedDates.Contains(_dt.Date))
                {
                    _mc.BoldedDates.Add(_dt.Date);
                }
            }

            _mc.ResumeLayout();

            _mc.Invalidate();
        }
示例#6
0
            /// <summary>
            /// Initializes a new instance of the <see cref="MonthCalendarControlDesignerActionList"/> class.
            /// </summary>
            /// <param name="component">The component.</param>
            public MonthCalendarControlDesignerActionList(IComponent component)
                : base(component)
            {
                Type compType = component.GetType();

                if (component == null || (compType != typeof(CustomControls.MonthCalendar) && compType != typeof(DatePicker)))
                {
                    throw new InvalidOperationException("MonthCalendarDesigner : component is null or not of the correct type.");
                }

                if (compType == typeof(DatePicker))
                {
                    this.cal = ((DatePicker)component).Picker;
                }
                else
                {
                    this.cal = (CustomControls.MonthCalendar)component;
                }

                this.iccs = (IComponentChangeService)GetService(typeof(IComponentChangeService));

                this.designerUISvc = (DesignerActionUIService)GetService(typeof(DesignerActionUIService));
            }
示例#7
0
        /// <summary>
        /// Edits the specified object's value using the editor style indicated by the
        /// <see cref="UITypeEditor"/><c>.GetEditStyle()</c> method.
        /// </summary>
        /// <param name="context">An <see cref="ITypeDescriptorContext"/> that can be used to gain
        /// additional context information.</param>
        /// <param name="provider">An <see cref="IServiceProvider"/> that this editor can use to obtain services.</param>
        /// <param name="value">The object to edit.</param>
        /// <returns>The new value of the object. If the value of the object has not changed,
        /// this should return the same object it was passed.</returns>
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            this.editorSvc = null;

            if (context != null && context.Instance != null && provider != null)
            {
                this.editorSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));

                if (this.editorSvc != null)
                {
                    CustomControls.MonthCalendar cal = context.Instance.GetType() == typeof(CustomControls.MonthCalendar)
                                      ? (CustomControls.MonthCalendar)context.Instance
                                      : ((DatePicker)context.Instance).Picker;

                    if (cal != null)
                    {
                        CalendarItem currentItem = null;

                        this.calendarListBox.Items.Clear();

                        bool addPersian = true, addHebrew = true;

                        foreach (Calendar c in cal.Culture.OptionalCalendars)
                        {
                            CalendarItem it = new CalendarItem(c);

                            if (c.GetType() == typeof(PersianCalendar))
                            {
                                addPersian = false;
                            }

                            if (c.GetType() == typeof(HebrewCalendar))
                            {
                                addHebrew = false;
                            }

                            this.calendarListBox.Items.Add(it);

                            if (c == cal.CultureCalendar)
                            {
                                currentItem = it;
                            }
                        }

                        if (currentItem != null)
                        {
                            this.calendarListBox.SelectedItem = currentItem;
                        }

                        List <CalendarItem> items = new List <CalendarItem>();

                        if (addPersian)
                        {
                            items.Add(new CalendarItem(new PersianCalendar(), false));
                        }

                        if (addHebrew)
                        {
                            items.Add(new CalendarItem(new HebrewCalendar(), false));
                        }

                        items.Add(new CalendarItem(new JulianCalendar(), false));
                        items.Add(new CalendarItem(new ChineseLunisolarCalendar(), false));
                        items.Add(new CalendarItem(new JapaneseLunisolarCalendar(), false));
                        items.Add(new CalendarItem(new KoreanLunisolarCalendar(), false));
                        items.Add(new CalendarItem(new TaiwanLunisolarCalendar(), false));

                        foreach (var item in items)
                        {
                            this.calendarListBox.Items.Add(item);

                            if (item.Item.GetType() == cal.CultureCalendar.GetType())
                            {
                                this.calendarListBox.SelectedItem = item;
                            }
                        }

                        this.editorSvc.DropDownControl(this.calendarListBox);

                        if (this.calendarListBox.SelectedItem != null)
                        {
                            return(((CalendarItem)this.calendarListBox.SelectedItem).Item);
                        }

                        return(cal.Culture.DateTimeFormat.Calendar);
                    }
                }
            }

            return(null);
        }
         /// <summary>
         /// Initializes a new instance of the <see cref="MonthCalendarControlDesignerActionList"/> class.
         /// </summary>
         /// <param name="component">The component.</param>
         public MonthCalendarControlDesignerActionList(IComponent component)
            : base(component)
         {
            Type compType = component.GetType();

            if (component == null || (compType != typeof(CustomControls.MonthCalendar) && compType != typeof(DatePicker)))
            {
               throw new InvalidOperationException("MonthCalendarDesigner : component is null or not of the correct type.");
            }

            if (compType == typeof(DatePicker))
            {
               this.cal = ((DatePicker)component).Picker;
            }
            else
            {
               this.cal = (CustomControls.MonthCalendar)component;
            }

            this.iccs = (IComponentChangeService)GetService(typeof(IComponentChangeService));

            this.designerUISvc = (DesignerActionUIService)GetService(typeof(DesignerActionUIService));
         }