Пример #1
0
        /// <summary>
        /// Initializes a new instance of the TimeSelectionItem class.
        /// </summary>
        public TimeSelectorItem()
        {
            m_IsContainer = true;
            this.AutoCollapseOnClick = false;

            _InnerContainer = new ItemContainer();
            _InnerContainer.ItemSpacing = 3;
            _InnerContainer.LayoutOrientation = eOrientation.Vertical;
            _InnerContainer.AutoCollapseOnClick = false;
            this.SubItems.Add(_InnerContainer);

            _HourCommand = new Command();
            _HourCommand.Executed += new EventHandler(HourCommandExecuted);
            _MinuteCommand = new Command();
            _MinuteCommand.Executed += new EventHandler(MinuteCommandExecuted);
            _MinuteChangeCommand = new Command();
            _MinuteChangeCommand.Executed += new EventHandler(MinuteChangeCommandExecuted);
            _ClearCommand = new Command();
            _ClearCommand.Executed += new EventHandler(ClearCommandExecuted);
            _AmPmCommand = new Command();
            _AmPmCommand.Executed += new EventHandler(AmPmCommandExecuted);
            _OkCommand = new Command();
            _OkCommand.Executed += new EventHandler(OkCommandExecuted);

            RecreateItems();
        }
Пример #2
0
 protected override void Dispose(bool disposing)
 {
     if (_HourCommand != null)
     {
         _HourCommand.Dispose();
         _HourCommand = null;
     }
     if (_MinuteCommand != null)
     {
         _MinuteCommand.Dispose();
         _MinuteCommand = null;
     }
     if (_MinuteChangeCommand != null)
     {
         _MinuteChangeCommand.Dispose();
         _MinuteChangeCommand = null;
     }
     if (_ClearCommand != null)
     {
         _ClearCommand.Dispose();
         _ClearCommand = null;
     }
     if (_AmPmCommand != null)
     {
         _AmPmCommand.Dispose();
         _AmPmCommand = null;
     }
     if (_OkCommand != null)
     {
         _OkCommand.Dispose();
         _OkCommand = null;
     }
     if (_DualButtonFont != null)
     {
         _DualButtonFont.Dispose();
         _DualButtonFont = null;
     }
     base.Dispose(disposing);
 }
Пример #3
0
 public void BuildSubItem(IList dataSource, string textProperty, Command cmd,int selectedIndex)
 {
     if (_dataSource == dataSource)
         return;
     this.SubItems.Clear( );
     _cmd = cmd == null ? new Command( ) : cmd;
     ButtonItem defItem = null;
     for (int i = 0; i < dataSource.Count; i++)
     {
         object item = dataSource[i];
         if (item == null)
             continue;
         string text = TypeHelper.GetStringValue(item, textProperty);
         if (string.IsNullOrEmpty(text))
             text = item.ToString( );
         object cmdParam = TypeHelper.GetPropertyValue(item, "CommandParameter");
         if (cmdParam == null)
             cmdParam = item;
         Command itemCmd = TypeHelper.GetPropertyValue<Command>(item, "Command");
         ButtonItem subItem = new ButtonItem(GetSubItemName(i), text)
         {
             CommandParameter = cmdParam,
             Command = _cmd
         };
         if (itemCmd != null)
         {
             subItem.Command = itemCmd;
             itemCmd.Executed += new EventHandler(_cmd_Executed);
         }
         this.SubItems.Add(subItem);
         if (i == selectedIndex)
             defItem = subItem;
     }
     _cmd.Executed += new EventHandler(_cmd_Executed);
     _dataSource = dataSource;
     this.AutoExpandOnClick = SubItems.Count > 0;
     if (defItem != null)
         _cmd.Execute(defItem);
 }
Пример #4
0
 public void BuildSubItem(IList dataSource, string textProperty, Command cmd)
 {
     BuildSubItem(dataSource, textProperty, cmd, 0);
 }