示例#1
0
        public static void AddEvent(BarBaseButtonItem control, ItemClickEventHandler eventhandler)
        {
            Delegate delegateList = eventHandlerList[control.Name];
            if (delegateList != null)
            {
                foreach (Delegate d in delegateList.GetInvocationList())
                    control.ItemClick -= (ItemClickEventHandler)d;
                eventHandlerList.RemoveHandler(control.Name, delegateList);
            }

            control.ItemClick += eventhandler;
            eventHandlerList.AddHandler(control.Name, eventhandler);
        }
示例#2
0
		private static void OnCommandChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
		{
			var listView = (ListViewBase)d;
			if (listView == null)
			{
				return;
			}
			if (!listView.IsItemClickEnabled)
			{
				Debug.WriteLine("ItemClick should be enabled in order to use the command");
				Debugger.Break();
			}
			ClearPreviousEvents(listView);
			if (e.NewValue == null)
			{
				return;
			}
			
			var eventHandler = new ItemClickEventHandler(ListViewBase_ItemClick);
			_eventHandlers.Add(listView, eventHandler);
			listView.ItemClick += eventHandler;
		}
示例#3
0
 public static BarButtonItem GetRefreshButton(ItemClickEventHandler handler)
 {
     var button = GetRefreshButton();
       button.ItemClick += handler;
       return button;
 }
示例#4
0
 public static BarButtonItem GetCustomButton(string caption, System.Drawing.Image glyph, ItemClickEventHandler handler)
 {
     var button = GetCustomButton(caption, glyph);
       button.ItemClick += handler;
       return button;
 }
        public IAsyncOperation <ContentDialogBaseResult> ShowAsync(TLMessagesStickerSet parameter, ItemClickEventHandler callback)
        {
            ViewModel.IsLoading  = false;
            ViewModel.StickerSet = parameter.Set;
            ViewModel.Items.Clear();
            ViewModel.Items.Add(parameter);

            return(ShowAsync());
        }
示例#6
0
 //
 public void CSV(ItemClickEventHandler handle)
 {
     BtnCSV.ItemClick += handle;
 }
示例#7
0
 //PRINT
 public void Print(ItemClickEventHandler handle)
 {
     BtnPrint.ItemClick += handle;
 }
示例#8
0
 // SAVE
 public void Save(ItemClickEventHandler handle)
 {
     BtnSave.ItemClick += handle;
 }
示例#9
0
 //DELETE
 public void Delete(ItemClickEventHandler handle)
 {
     BtnDelete.ItemClick += handle;
 }
示例#10
0
 public IAsyncOperation <ContentDialogBaseResult> ShowAsync(StickerSet parameter, ItemClickEventHandler callback)
 {
     return(ShowAsync(parameter.Id, callback));
 }
示例#11
0
        /// <summary>
        /// Insert BarItem into bar.
        /// </summary>
        /// <typeparam name="T">Type of BarItem.</typeparam>
        /// <param name="bar">Bar</param>
        /// <param name="index">Index of BarItem.</param>
        /// <param name="caption">Caption of BarItem.</param>
        /// <param name="glyph">Glyph of BarItem.</param>
        /// <param name="key">Key of BarItem (ItemShortcut).</param>
        /// <param name="itemClick">ItemClick of BarItem.</param>
        /// <returns>Returns inserted BarItem</returns>
        public static T InsertBarItem <T>(this Bar bar, int index, string caption, Image glyph = null, Keys key = Keys.None, ItemClickEventHandler itemClick = null) where T : BarItem, new()
        {
            var item = new T
            {
                Caption = caption,
                Glyph   = glyph
            };

            if (key != Keys.None)
            {
                item.ItemShortcut = new BarShortcut(key);
            }


            if (bar.LinksPersistInfo.Count > 0 && bar.ItemLinks.Count == 0)
            {
                if (index > bar.LinksPersistInfo.Count)
                {
                    index = bar.LinksPersistInfo.Count;
                }

                bar.LinksPersistInfo.Insert(index, new LinkPersistInfo(item));
            }
            else if (bar.ItemLinks.Count > 0)
            {
                if (index > bar.ItemLinks.Count)
                {
                    index = bar.ItemLinks.Count;
                }

                bar.InsertItem(bar.ItemLinks[index], item);
            }
            else
            {
                bar.AddItem(item);
            }

            //bar.ItemLinks.Insert(index, item);

            if (itemClick != null)
            {
                item.ItemClick += itemClick;
            }

            return(item);
        }
示例#12
0
        /// <summary>
        /// Add BarItem into barSubItem.
        /// </summary>
        /// <typeparam name="T">Type of BarItem.</typeparam>
        /// <param name="barSubItem">Owner item</param>
        /// <param name="caption">Caption of BarItem.</param>
        /// <param name="glyph">Glyph of BarItem.</param>
        /// <param name="key">Key of BarItem (ItemShortcut).</param>
        /// <param name="itemClick">ItemClick of BarItem.</param>
        /// <returns>Returns added BarItem</returns>
        public static T AddBarItem <T>(this BarSubItem barSubItem, string caption, Image glyph, Keys key = Keys.None, ItemClickEventHandler itemClick = null) where T : BarItem, new()
        {
            var item = new T
            {
                Caption = caption,
                Glyph   = glyph
            };

            if (key != Keys.None)
            {
                item.ItemShortcut = new BarShortcut(key);
            }

            barSubItem.AddItem(item);
            if (itemClick != null)
            {
                item.ItemClick += itemClick;
            }
            return(item);
        }
示例#13
0
        /// <summary>
        /// Add AddBarCheckItem into bar.
        /// </summary>
        /// <typeparam name="T">Type of BarCheckItem.</typeparam>
        /// <param name="barSubItem">BarSubItem</param>
        /// <param name="caption">Caption of BarCheckItem.</param>
        /// <param name="glyph">Glyph of BarCheckItem.</param>
        /// <param name="key">Key of BarCheckItem (ItemShortcut).</param>
        /// <param name="checkedChanged">CheckedChanged of BarCheckItem.</param>
        /// <returns>Returns inserted BarItem</returns>
        public static T AddBarCheckItem <T>(this BarSubItem barSubItem, string caption, Image glyph = null, Keys key = Keys.None, ItemClickEventHandler checkedChanged = null) where T : BarCheckItem, new()
        {
            var item = AddBarItem <T>(barSubItem, caption, glyph, key);

            if (checkedChanged != null && item != null)
            {
                item.CheckedChanged += checkedChanged;
            }

            return(item);
        }
示例#14
0
 public static void CreateBusinessMenu(PivotGridControl gridMaster, BarSubItem barSubItem1, 
     string fieldName, string[] captions, string[] ImageNames,
     DelegationLib.CallFunction_MulIn_NoOut[] delegates, PermissionItem[] pers)
 {
     ItemClickEventHandler handler = null;
     if (captions == null)
     {
         barSubItem1.Visibility = BarItemVisibility.Never;
     }
     else
     {
         int index = 0;
         foreach (string str in captions)
         {
             bool? nullable;
             if (((pers != null) && (pers[index] != null)) &&
                 !(ApplyPermissionAction.checkPermission(pers[index]).HasValue &&
                 !(!(nullable = ApplyPermissionAction.checkPermission(pers[index])).GetValueOrDefault() && nullable.HasValue)))
             {
                 index++;
             }
             else
             {
                 BarButtonItem item = new BarButtonItem();
                 item.Caption = captions[index];
                 item.Name=index.ToString();
                 if (!ImageNames[index].Equals(""))
                 {
                     item.Glyph=ResourceMan.getImage16(ImageNames[index]);
                 }
                 item.PaintStyle = BarItemPaintStyle.Standard;
                 if (handler == null)
                 {
                     handler += new ItemClickEventHandler(delegate(object sender,  ItemClickEventArgs e)
                     {
                         if (gridMaster.Cells.MultiSelection.SelectedCells.Count < 1)
                         {
                             HelpMsgBox.ShowNotificationMessage("");
                         }
                         else
                         {
                             List<object> data = new List<object>();
                             foreach (Point point in gridMaster.Cells.MultiSelection.SelectedCells)
                             {
                                 data.Add(point);
                             }
                             delegates[HelpNumber.ParseInt32(e.Item.Name)](data);
                         }
                     });
                 }
                 item.ItemClick += handler;
                 barSubItem1.ItemLinks.Add(item);
                 index++;
             }
         }
         if ((barSubItem1.ItemLinks == null) || (barSubItem1.ItemLinks.Count == 0))
         {
             barSubItem1.Visibility = BarItemVisibility.Never;
         }
     }
 }
示例#15
0
        public IAsyncOperation <ContentDialogBaseResult> ShowAsync(TLInputStickerSetBase parameter, ItemClickEventHandler callback)
        {
            ViewModel.IsLoading  = true;
            ViewModel.StickerSet = new TLStickerSet();
            ViewModel.Items.Clear();

            RoutedEventHandler handler = null;

            handler = new RoutedEventHandler(async(s, args) =>
            {
                Loaded   -= handler;
                ItemClick = callback;
                await ViewModel.OnNavigatedToAsync(parameter, NavigationMode.New, null);
            });

            Loaded += handler;
            return(ShowAsync());
        }
示例#16
0
 public Task <ContentDialogResult> ShowAsync(StickerSet parameter, ItemClickEventHandler callback)
 {
     return(ShowAsync(parameter.Id, callback));
 }
示例#17
0
 //ADD - NEW
 public void Add(ItemClickEventHandler handle)
 {
     BtnAdd.ItemClick += handle;
 }
示例#18
0
        /// <summary>
        /// Configures the Landscape with a click event delegate, styles, and sizes. Must be called before it can be used.
        /// </summary>
        /// <param name="ClickHandler">An ItemClickEventHandler delegate which is called when any item in the GridView is clicked.</param>
        /// <param name="TileStyle">The styling for each tile in the Grid View.</param>
        /// <param name="ItemTemplate">The XAML describing what controls are in each tile in the Grid View.</param>
        /// <param name="ClickHandlerSnapped">An ItemClickEventHandler delegate which is called when any item in the ListView is clicked while snapped. This is normally the same as the ClickHandler parameter.</param>
        /// <param name="TileStyleSnapped">The styling for each tile in the List View when snapped. Pass null if ListView isn't supported.</param>
        /// <param name="ItemTemplateSnapped">The XAML describing what controls are in each tile in the List View when snapped. Pass null if ListView isn't supported.</param>
        /// <param name="height">The available height in the Grid row hosting the Landscape control.</param>
        /// <param name="startingState">The starting view state (snapped or filled) for proper visual set up.</param>
        /// <param name="IsItemClickEnabled">Determines whether the Grid View items themselves can be clicked - use false if they are carrying controls.</param>
        public void Configure(ItemClickEventHandler ClickHandler, Style TileStyle, DataTemplate ItemTemplate, ItemClickEventHandler ClickHandlerSnapped,
                              Style TileStyleSnapped, DataTemplate ItemTemplateSnapped, double height, bool IsItemClickEnabled)
        {
            if (ClickHandler != null)
            {
                this.LandscapeContent.ItemClick += ClickHandler;
            }
            this.LandscapeContent.ItemTemplate = ItemTemplate;

            this.LandscapeContent.IsItemClickEnabled        = IsItemClickEnabled;
            this.LandscapeContentSnapped.IsItemClickEnabled = IsItemClickEnabled;

            adjustedHeight = 450; //hard coded for now
            //if (adjustedHeight > MAX_ITEM_HEIGHT)
            //    adjustedHeight = MAX_ITEM_HEIGHT;

            try //If the setter is already added, then there will be an error if you're trying to add it again
            {
                TileStyle.Setters.Add(new Setter(GridViewItem.HeightProperty, adjustedHeight));
                TileStyle.Setters.Add(new Setter(GridViewItem.WidthProperty, adjustedHeight));
            }
            catch { }

            this.LandscapeContent.ItemContainerStyle = TileStyle;

            if (ClickHandlerSnapped != null)
            {
                this.LandscapeContentSnapped.ItemClick += ClickHandlerSnapped;
            }

            this.LandscapeContentSnapped.ItemTemplate       = ItemTemplateSnapped;
            this.LandscapeContentSnapped.ItemContainerStyle = TileStyleSnapped;

            //This also sets the built-in view state, which is used for proper scrolling
            ChangeViewState();

            configured = true;
        }
示例#19
0
 //EDIT
 public void Edit(ItemClickEventHandler handle)
 {
     BtnEdit.ItemClick += handle;
 }
        /// <summary>
        /// 添加按钮
        /// </summary>
        /// <param name="btn">按钮对象</param>
        /// <param name="Authority">权限,默认0</param>
        /// <param name="DoClick">事件绑定</param>
        protected void AddButton(RibbonItemButtonBase btn, int Authority, ItemClickEventHandler DoClick)
        {
            var bi = AddButton(btn, Authority, "");

            bi.ItemClick += DoClick;
        }
示例#21
0
 //REPORT
 public void Report(ItemClickEventHandler handle)
 {
     BtnReport.ItemClick += handle;
 }
        protected void InsertAfterButton(string ReferButtonName, RibbonItemButtonBase btn, int Authority, string AuthorityName, ItemClickEventHandler DoClick)
        {
            var bi = InsertButton(ReferButtonName, false, btn, Authority, AuthorityName);

            bi.ItemClick += DoClick;
        }
示例#23
0
 //EXCEL
 public void Excel(ItemClickEventHandler handle)
 {
     BtnExcel.ItemClick += handle;
 }
示例#24
0
        public ControlPanelItem AddItem(int icon, string caption, string toolTip, string tag, ItemClickEventHandler onClickEvent)
        {
            ControlPanelItem item = new ControlPanelItem(this, tag, icon, caption, toolTip);

            m_ItemsDictionary.Add(tag, item);

            item.ItemClickEvent += onClickEvent;

            return item;
        }
示例#25
0
        public bool AddButtonItem(string pageName, string groupName, string itemName, Image itemImage, ItemClickEventHandler callBack, ref string restr)
        {
            DevExpress.XtraBars.Ribbon.RibbonPage page = this.ribbon_Title.Pages.GetPageByName(pageName);
            if (page == null)
            {
                restr = "不存在[" + page + "]标题页!";
                return(false);
            }
            DevExpress.XtraBars.Ribbon.RibbonPageGroup group = page.Groups.GetGroupByName(groupName);
            if (group == null)
            {
                restr = "不存在[" + groupName + "]组!";
                return(false);
            }
            DevExpress.XtraBars.BarButtonItem buttonItem = new BarButtonItem();

            buttonItem.Name    = itemName;
            buttonItem.Caption = itemName;
            buttonItem.ImageOptions.LargeImage = itemImage;
            buttonItem.ItemClick += callBack;
            group.ItemLinks.Add(buttonItem);
            restr = "添加菜单项成功!";
            return(true);
        }
示例#26
0
 //VIEW
 public void View(ItemClickEventHandler handle)
 {
     BtnView.ItemClick += handle;
 }
 public IAsyncOperation <ContentDialogBaseResult> ShowAsync(TLStickerSet parameter, ItemClickEventHandler callback)
 {
     return(ShowAsync(new TLInputStickerSetID {
         Id = parameter.Id, AccessHash = parameter.AccessHash
     }, callback));
 }
示例#28
0
 //CLOSE
 public void Close(ItemClickEventHandler handle)
 {
     BtnClose.ItemClick += handle;
 }
示例#29
0
 public static BarButtonItem GetPrintButton(string caption, ItemClickEventHandler handler)
 {
     var button = GetPrintButton(caption);
       button.ItemClick += handler;
       return button;
 }
示例#30
0
 //FORWARD
 public void Forward(ItemClickEventHandler handle)
 {
     BtnFrd.ItemClick += handle;
 }
示例#31
0
 /// <summary>
 /// Adds the bar item.
 /// </summary>
 /// <param name="caption">The caption.</param>
 /// <param name="glyph">The glyph.</param>
 /// <param name="largeGlyph">The large glyph.</param>
 /// <param name="itemClickEventHandler">The item click event handler.</param>
 /// <param name="beginGroup">if set to <c>true</c> [begin group].</param>
 /// <returns></returns>
 private BarButtonItem AddBarItem(string caption, Image glyph, Image largeGlyph,
     ItemClickEventHandler itemClickEventHandler, bool beginGroup)
 {
     BarButtonItem item = new BarButtonItem(Manager, caption);
     item.Glyph = glyph;
     item.LargeGlyph = largeGlyph;
     item.ItemClick += itemClickEventHandler;
     BarItemLink link = AddItem(item);
     link.BeginGroup = beginGroup;
     return item;
 }
示例#32
0
 //PREVERSE
 public void Preverse(ItemClickEventHandler handle)
 {
     BtnPrv.ItemClick += handle;
 }