コード例 #1
0
        public void SetUp()
        {
            ism = new InitialSelectionManager();

            coll = new ListItemCollection();

            //Put some dates in the collection
            DateTime start = new DateTime(2007, 1, 1);
            DateTime end   = new DateTime(2009, 1, 1);

            for (DateTime date = start; date <= end; date = date.AddHours(6))
            {
                coll.Add(date.ToString(DateFormat, CultureInfo.InvariantCulture));
            }
        }
コード例 #2
0
        /// <summary>
        /// <para>The overridden method called just before saving view state and rendering the content. It is responsible
        /// for setting the generated date/time items and set the initial selection.</para>
        /// </summary>
        /// <param name="e">
        /// an instance of the EventArgs. This argument is not directly used in this method - it is simply sent to the
        /// super method. Can be any value.
        /// </param>
        /// <exception cref="InitialSelectionInvalidDataException">
        /// if any problem with setting initial selection occurs.
        /// </exception>
        /// <exception cref="RuleInvalidDataException">
        /// if any problem with generating date/time items by Rule class occurs
        /// </exception>
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);

            if (!Page.IsPostBack)
            {
                //Get dates and add to items
                string[] dates = DatePattern.GenerateDates();
                foreach (string date in dates)
                {
                    Items.Add(date);
                }

                //Initial selection
                InitialSelectionManager initSelectionMgr = new InitialSelectionManager(
                    InitialSelection, InitialSelectionTimeStamp, InitialSelectionDateFormat);
                initSelectionMgr.SelectItems(Items, false, DisplayDateFormat);
            }
        }
コード例 #3
0
ファイル: DateListBox.cs プロジェクト: kurtrips/tc
        /// <summary>
        /// <para>The overridden method called just before saving view state and rendering the content. It is responsible
        /// for setting the generated date/time items and set the initial selection.</para>
        /// </summary>
        /// <param name="e">
        /// an instance of the EventArgs. This argument is not directly used in this method - it is simply sent to the
        /// super method. Can be any value.
        /// </param>
        /// <exception cref="InitialSelectionInvalidDataException">
        /// if any problem with setting initial selection occurs.
        /// </exception>
        /// <exception cref="RuleInvalidDataException">
        /// if any problem with generating date/time items by Rule class occurs
        /// </exception>
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);

            if (!Page.IsPostBack)
            {
                //Get dates and add to items
                string[] dates = DatePattern.GenerateDates();
                foreach (string date in dates)
                {
                    Items.Add(date);
                }

                //Initial selection
                InitialSelectionManager initSelectionMgr = new InitialSelectionManager(
                    InitialSelection, InitialSelectionTimeStamp, InitialSelectionDateFormat);
                //Allow multiple selected dates if the control allows
                initSelectionMgr.SelectItems(Items, (SelectionMode == ListSelectionMode.Multiple), DisplayDateFormat);
            }
        }
コード例 #4
0
 public void TestConstructor3()
 {
     ism = new InitialSelectionManager(InitialSelectionManager.SelectClosestNotAfterTimeStamp, DateFormat);
     Assert.IsNotNull(ism, "Contructor returns null.");
 }
コード例 #5
0
 public void TearDown()
 {
     ism  = null;
     coll = null;
 }
コード例 #6
0
 public void TestConstructorFail3()
 {
     ism = new InitialSelectionManager(InitialSelectionManager.SelectClosestNotAfterTimeStamp,
                                       "08/03/2007 21:45", null);
 }
コード例 #7
0
 public void TestConstructorFail2()
 {
     ism = new InitialSelectionManager(InitialSelectionManager.SelectClosestNotAfterTimeStamp, null, DateFormat);
 }
コード例 #8
0
 public void TestConstructorFail1()
 {
     ism = new InitialSelectionManager(null, "08/03/2007 21:45", DateFormat);
 }