コード例 #1
0
        /// <summary>
        /// Gets the HitArea for MonthView items
        /// </summary>
        /// <param name="mv"></param>
        /// <param name="objArg"></param>
        /// <returns>eHitArea</returns>
        private eHitArea GetMonthHitArea(MonthView mv, MouseEventArgs objArg)
        {
            // Get what week this item is in, so we can
            // determine whether the item extends into either
            // the next or previous weeks

            MonthWeek monthWeek = mv.GetItemWeek(this);

            DateTime start = monthWeek.FirstDayOfWeek;
            DateTime end   = start.AddDays(7);

            // See if we are in the left resize area

            if (StartTime >= start && objArg.Location.X < Bounds.X + ResizeArea)
            {
                return(eHitArea.LeftResize);
            }

            // See if we are in the right resize area

            if (EndTime <= end && objArg.Location.X > Bounds.Right - ResizeArea)
            {
                return(eHitArea.RightResize);
            }

            // By default we are in the move area

            return(eHitArea.Move);
        }
コード例 #2
0
ファイル: CalendarWeek.cs プロジェクト: Stexinator/chummer5a
        /// <summary>
        /// Print the object's XML to the XmlWriter.
        /// </summary>
        /// <param name="objWriter">XmlTextWriter to write with.</param>
        /// <param name="objCulture">Culture in which to print numbers.</param>
        /// <param name="blnPrintNotes">Whether to print notes attached to the CalendarWeek.</param>
        public async ValueTask Print(XmlWriter objWriter, CultureInfo objCulture, bool blnPrintNotes = true)
        {
            if (objWriter == null)
            {
                return;
            }
            // <week>
            XmlElementWriteHelper objBaseElement = await objWriter.StartElementAsync("week");

            try
            {
                await objWriter.WriteElementStringAsync("guid", InternalId);

                await objWriter.WriteElementStringAsync("year", Year.ToString(objCulture));

                await objWriter.WriteElementStringAsync("month", Month.ToString(objCulture));

                await objWriter.WriteElementStringAsync("week", MonthWeek.ToString(objCulture));

                if (blnPrintNotes)
                {
                    await objWriter.WriteElementStringAsync("notes", Notes);
                }
            }
            finally
            {
                // </week>
                await objBaseElement.DisposeAsync();
            }
        }
コード例 #3
0
 /// <summary>
 /// Print the object's XML to the XmlWriter.
 /// </summary>
 /// <param name="objWriter">XmlTextWriter to write with.</param>
 /// <param name="objCulture">Culture in which to print numbers.</param>
 /// <param name="blnPrintNotes">Whether to print notes attached to the CalendarWeek.</param>
 public void Print(XmlTextWriter objWriter, CultureInfo objCulture, bool blnPrintNotes = true)
 {
     objWriter.WriteStartElement("week");
     objWriter.WriteElementString("year", Year.ToString(objCulture));
     objWriter.WriteElementString("month", Month.ToString(objCulture));
     objWriter.WriteElementString("week", MonthWeek.ToString(objCulture));
     if (blnPrintNotes)
     {
         objWriter.WriteElementString("notes", Notes);
     }
     objWriter.WriteEndElement();
 }