Ejemplo n.º 1
0
        private void AddColumnMenuItems(
            RadMenuItem parentItem,
            GridViewTemplate template,
            string headerItemName)
        {
            List <RadMenuItemBase> radMenuItemBaseList = new List <RadMenuItemBase>();

            radMenuItemBaseList.Add((RadMenuItemBase) new RadMenuHeaderItem(headerItemName));
            RadMenuItem radMenuItem1 = new RadMenuItem(LocalizationProvider <RadGridLocalizationProvider> .CurrentProvider.GetLocalizedString("SearchRowMenuItemAllColumns"), (object)template);

            radMenuItem1.Click    += new EventHandler(this.ColumnItem_Click);
            radMenuItem1.IsChecked = true;
            radMenuItemBaseList.Add((RadMenuItemBase)radMenuItem1);
            radMenuItemBaseList.Add((RadMenuItemBase) new RadMenuSeparatorItem());
            foreach (GridViewDataColumn column in (Collection <GridViewDataColumn>)template.Columns)
            {
                if (column.IsVisible)
                {
                    RadMenuItem radMenuItem2 = new RadMenuItem(column.HeaderText, (object)column);
                    radMenuItem2.Click    += new EventHandler(this.ColumnItem_Click);
                    radMenuItem2.IsChecked = column.AllowSearching;
                    radMenuItemBaseList.Add((RadMenuItemBase)radMenuItem2);
                    if (!radMenuItem2.IsChecked)
                    {
                        radMenuItem1.IsChecked = false;
                    }
                }
            }
            if (template.Templates.Count > 0)
            {
                RadMenuHeaderItem radMenuHeaderItem = new RadMenuHeaderItem(LocalizationProvider <RadGridLocalizationProvider> .CurrentProvider.GetLocalizedString("SearchRowMenuItemChildTemplates"));
                radMenuHeaderItem.Margin = new Padding(0, 5, 0, 0);
                radMenuItemBaseList.Add((RadMenuItemBase)radMenuHeaderItem);
                foreach (GridViewTemplate template1 in (Collection <GridViewTemplate>)template.Templates)
                {
                    string text = template1.Caption;
                    if (string.IsNullOrEmpty(text))
                    {
                        text = "Child Template " + (object)(template.Templates.IndexOf(template1) + 1);
                    }
                    RadMenuItem parentItem1 = new RadMenuItem(text);
                    parentItem1.DropDownClosing += new RadPopupClosingEventHandler(this.ChooseColumnsMenuItem_DropDownClosing);
                    this.AddColumnMenuItems(parentItem1, template1, template1.Caption);
                    radMenuItemBaseList.Add((RadMenuItemBase)parentItem1);
                }
            }
            parentItem.Items.AddRange((RadItem[])radMenuItemBaseList.ToArray());
        }
 protected virtual void CreateCommands()
 {
     this.transformItem        = new RadMenuHeaderItem(LocalizationProvider <ImageEditorLocalizationProvider> .CurrentProvider.GetLocalizedString("CommandsTransform"));
     this.transformItem.Margin = new Padding(0, 15, 0, 0);
     this.commandsStackViewport.Children.Add((RadElement)this.transformItem);
     this.resizeItem        = new RadMenuItem(LocalizationProvider <ImageEditorLocalizationProvider> .CurrentProvider.GetLocalizedString("CommandsResize"));
     this.resizeItem.Click += (EventHandler)((param0, param1) => this.ImageEditorElement.ShowResizeDialog());
     this.commandsStackViewport.Children.Add((RadElement)this.resizeItem);
     this.canvasResizeItem        = new RadMenuItem(LocalizationProvider <ImageEditorLocalizationProvider> .CurrentProvider.GetLocalizedString("CommandsCanvasResize"));
     this.canvasResizeItem.Click += (EventHandler)((param0, param1) => this.ImageEditorElement.ShowCanvasResizeDialog());
     this.commandsStackViewport.Children.Add((RadElement)this.canvasResizeItem);
     this.rotate90Item        = new RadMenuItem(LocalizationProvider <ImageEditorLocalizationProvider> .CurrentProvider.GetLocalizedString("CommandsRotate90"));
     this.rotate90Item.Click += (EventHandler)((param0, param1) =>
     {
         this.ImageEditorElement.RotateFlip(RotateFlipType.Rotate90FlipNone);
         this.ImageEditorElement.SaveState();
     });
     this.commandsStackViewport.Children.Add((RadElement)this.rotate90Item);
     this.rotate180Item        = new RadMenuItem(LocalizationProvider <ImageEditorLocalizationProvider> .CurrentProvider.GetLocalizedString("CommandsRotate180"));
     this.rotate180Item.Click += (EventHandler)((param0, param1) =>
     {
         this.ImageEditorElement.RotateFlip(RotateFlipType.Rotate180FlipNone);
         this.ImageEditorElement.SaveState();
     });
     this.commandsStackViewport.Children.Add((RadElement)this.rotate180Item);
     this.rotate270Item        = new RadMenuItem(LocalizationProvider <ImageEditorLocalizationProvider> .CurrentProvider.GetLocalizedString("CommandsRotate270"));
     this.rotate270Item.Click += (EventHandler)((param0, param1) =>
     {
         this.ImageEditorElement.RotateFlip(RotateFlipType.Rotate270FlipNone);
         this.ImageEditorElement.SaveState();
     });
     this.commandsStackViewport.Children.Add((RadElement)this.rotate270Item);
     this.roundCornersItem        = new RadMenuItem(LocalizationProvider <ImageEditorLocalizationProvider> .CurrentProvider.GetLocalizedString("CommandsRoundCorners"));
     this.roundCornersItem.Click += (EventHandler)((param0, param1) => this.ImageEditorElement.ShowRoundCornersDialog());
     this.commandsStackViewport.Children.Add((RadElement)this.roundCornersItem);
     this.flipHorizontalItem        = new RadMenuItem(LocalizationProvider <ImageEditorLocalizationProvider> .CurrentProvider.GetLocalizedString("CommandsFlipHorizontal"));
     this.flipHorizontalItem.Click += (EventHandler)((param0, param1) =>
     {
         this.ImageEditorElement.RotateFlip(RotateFlipType.RotateNoneFlipX);
         this.ImageEditorElement.SaveState();
     });
     this.commandsStackViewport.Children.Add((RadElement)this.flipHorizontalItem);
     this.flipVerticalItem        = new RadMenuItem(LocalizationProvider <ImageEditorLocalizationProvider> .CurrentProvider.GetLocalizedString("CommandsFlipVertical"));
     this.flipVerticalItem.Click += (EventHandler)((param0, param1) =>
     {
         this.ImageEditorElement.RotateFlip(RotateFlipType.Rotate180FlipX);
         this.ImageEditorElement.SaveState();
     });
     this.commandsStackViewport.Children.Add((RadElement)this.flipVerticalItem);
     this.cropItem        = new RadMenuItem(LocalizationProvider <ImageEditorLocalizationProvider> .CurrentProvider.GetLocalizedString("CommandsCrop"));
     this.cropItem.Click += (EventHandler)((param0, param1) =>
     {
         if (this.ImageEditorElement.CanvasElement.IsCropping)
         {
             this.ImageEditorElement.StopCrop(false);
         }
         else
         {
             this.ImageEditorElement.StartCrop();
         }
     });
     this.commandsStackViewport.Children.Add((RadElement)this.cropItem);
     this.drawTextItem        = new RadMenuItem(LocalizationProvider <ImageEditorLocalizationProvider> .CurrentProvider.GetLocalizedString("CommandsDrawText"));
     this.drawTextItem.Click += (EventHandler)((param0, param1) => this.ImageEditorElement.ShowDrawTextDialog());
     this.commandsStackViewport.Children.Add((RadElement)this.drawTextItem);
     this.drawItem        = new RadMenuItem(LocalizationProvider <ImageEditorLocalizationProvider> .CurrentProvider.GetLocalizedString("CommandsDraw"));
     this.drawItem.Click += (EventHandler)((param0, param1) => this.ImageEditorElement.ShowDrawDialog());
     this.commandsStackViewport.Children.Add((RadElement)this.drawItem);
     this.drawShapeItem        = new RadMenuItem(LocalizationProvider <ImageEditorLocalizationProvider> .CurrentProvider.GetLocalizedString("CommandsDrawShape"));
     this.drawShapeItem.Click += (EventHandler)((param0, param1) => this.ImageEditorElement.ShowDrawShapeDialog());
     this.commandsStackViewport.Children.Add((RadElement)this.drawShapeItem);
     this.panItem        = new RadMenuItem(LocalizationProvider <ImageEditorLocalizationProvider> .CurrentProvider.GetLocalizedString("CommandsPan"));
     this.panItem.Click += (EventHandler)((param0, param1) =>
     {
         if (this.ImageEditorElement.CanvasElement.IsPanning)
         {
             this.ImageEditorElement.StopPan();
         }
         else
         {
             this.ImageEditorElement.StartPan();
         }
     });
     this.commandsStackViewport.Children.Add((RadElement)this.panItem);
     this.adjustItem        = new RadMenuHeaderItem(LocalizationProvider <ImageEditorLocalizationProvider> .CurrentProvider.GetLocalizedString("CommandsAdjust"));
     this.adjustItem.Margin = new Padding(0, 10, 0, 0);
     this.commandsStackViewport.Children.Add((RadElement)this.adjustItem);
     this.hueShiftItem        = new RadMenuItem(LocalizationProvider <ImageEditorLocalizationProvider> .CurrentProvider.GetLocalizedString("CommandsHue"));
     this.hueShiftItem.Click += (EventHandler)((param0, param1) => this.ImageEditorElement.ShowHueDialog());
     this.commandsStackViewport.Children.Add((RadElement)this.hueShiftItem);
     this.saturationItem        = new RadMenuItem(LocalizationProvider <ImageEditorLocalizationProvider> .CurrentProvider.GetLocalizedString("CommandsSaturation"));
     this.saturationItem.Click += (EventHandler)((param0, param1) => this.ImageEditorElement.ShowSaturationDialog());
     this.commandsStackViewport.Children.Add((RadElement)this.saturationItem);
     this.contrastItem        = new RadMenuItem(LocalizationProvider <ImageEditorLocalizationProvider> .CurrentProvider.GetLocalizedString("CommandsContrast"));
     this.contrastItem.Click += (EventHandler)((param0, param1) => this.ImageEditorElement.ShowContrastDialog());
     this.commandsStackViewport.Children.Add((RadElement)this.contrastItem);
     this.invertColorsItem        = new RadMenuItem(LocalizationProvider <ImageEditorLocalizationProvider> .CurrentProvider.GetLocalizedString("CommandsInvertColors"));
     this.invertColorsItem.Click += (EventHandler)((param0, param1) =>
     {
         this.ImageEditorElement.InvertColors();
         this.ImageEditorElement.SaveState();
     });
     this.commandsStackViewport.Children.Add((RadElement)this.invertColorsItem);
     this.effectsItem        = new RadMenuHeaderItem(LocalizationProvider <ImageEditorLocalizationProvider> .CurrentProvider.GetLocalizedString("CommandsEffects"));
     this.effectsItem.Margin = new Padding(0, 10, 0, 0);
     this.commandsStackViewport.Children.Add((RadElement)this.effectsItem);
     this.sharpenItem        = new RadMenuItem(LocalizationProvider <ImageEditorLocalizationProvider> .CurrentProvider.GetLocalizedString("CommandsSharpen"));
     this.sharpenItem.Click += (EventHandler)((param0, param1) => this.ImageEditorElement.ShowSharpenDialog());
     this.commandsStackViewport.Children.Add((RadElement)this.sharpenItem);
     this.blurItem        = new RadMenuItem(LocalizationProvider <ImageEditorLocalizationProvider> .CurrentProvider.GetLocalizedString("CommandsBlur"));
     this.blurItem.Click += (EventHandler)((param0, param1) => this.ImageEditorElement.ShowBlurDialog());
     this.commandsStackViewport.Children.Add((RadElement)this.blurItem);
 }