Beispiel #1
0
        public void Save(string themeFilePath)
        {
            if ((themeFilePath == null) || (themeFilePath.Length == 0))
            {
                throw new ArgumentException(DR.GetString("ThemePathNotValid", new object[0]), "themeFilePath");
            }
            DesignerSerializationManager manager = new DesignerSerializationManager();

            using (manager.CreateSession())
            {
                WorkflowMarkupSerializationManager serializationManager = new WorkflowMarkupSerializationManager(manager);
                XmlWriter writer = null;
                ThemeSerializationProvider provider = new ThemeSerializationProvider();
                try
                {
                    string directoryName = Path.GetDirectoryName(themeFilePath);
                    if ((directoryName.Length > 0) && !Directory.Exists(directoryName))
                    {
                        Directory.CreateDirectory(directoryName);
                    }
                    writer = Helpers.CreateXmlWriter(themeFilePath);
                    serializationManager.AddSerializationProvider(provider);
                    new WorkflowMarkupSerializer().Serialize(serializationManager, writer, this);
                }
                finally
                {
                    serializationManager.RemoveSerializationProvider(provider);
                    if (writer != null)
                    {
                        writer.Close();
                    }
                }
                this.filePath = themeFilePath;
            }
        }
Beispiel #2
0
        protected override void Initialize(Activity activity)
        {
            base.Initialize(activity);

            HelpText = DR.GetString(DR.SpecifyTargetWorkflow);
            RefreshTargetWorkflowType();
        }
 private void OnMenuPrint(object sender, EventArgs e)
 {
     if (PrinterSettings.InstalledPrinters.Count < 1)
     {
         DesignerHelpers.ShowError(this.serviceProvider, DR.GetString("ThereIsNoPrinterInstalledErrorMessage", new object[0]));
     }
     else
     {
         PrintDocument printDocument = this.workflowView.PrintDocument;
         PrintDialog   dialog        = new PrintDialog {
             AllowPrintToFile = false,
             Document         = printDocument
         };
         try
         {
             if (DialogResult.OK == dialog.ShowDialog())
             {
                 PrinterSettings printerSettings     = printDocument.PrinterSettings;
                 PageSettings    defaultPageSettings = printDocument.DefaultPageSettings;
                 printDocument.PrinterSettings     = dialog.PrinterSettings;
                 printDocument.DefaultPageSettings = dialog.Document.DefaultPageSettings;
                 printDocument.Print();
                 printDocument.PrinterSettings     = printerSettings;
                 printDocument.DefaultPageSettings = defaultPageSettings;
             }
         }
         catch (Exception exception)
         {
             string message = DR.GetString("SelectedPrinterIsInvalidErrorMessage", new object[0]) + "\n" + exception.Message;
             DesignerHelpers.ShowError(this.serviceProvider, message);
         }
     }
 }
        private void OnMenuSaveWorkflowAsImage(object sender, EventArgs e)
        {
            List <SupportedImageFormats> list = new List <SupportedImageFormats> {
                new SupportedImageFormats(DR.GetString("BMPImageFormat", new object[0]), ImageFormat.Bmp),
                new SupportedImageFormats(DR.GetString("JPEGImageFormat", new object[0]), ImageFormat.Jpeg),
                new SupportedImageFormats(DR.GetString("PNGImageFormat", new object[0]), ImageFormat.Png),
                new SupportedImageFormats(DR.GetString("TIFFImageFormat", new object[0]), ImageFormat.Tiff),
                new SupportedImageFormats(DR.GetString("WMFImageFormat", new object[0]), ImageFormat.Wmf),
                new SupportedImageFormats(DR.GetString("EXIFImageFormat", new object[0]), ImageFormat.Exif),
                new SupportedImageFormats(DR.GetString("EMFImageFormat", new object[0]), ImageFormat.Emf)
            };
            SaveFileDialog dialog = new SaveFileDialog {
                Title      = DR.GetString("SaveWorkflowImageDialogTitle", new object[0]),
                DefaultExt = "bmp"
            };
            string str = string.Empty;

            foreach (SupportedImageFormats formats in list)
            {
                str = str + ((str.Length > 0) ? ("|" + formats.Description) : formats.Description);
            }
            dialog.Filter      = str;
            dialog.FilterIndex = 0;
            if (((dialog.ShowDialog() == DialogResult.OK) && (dialog.FilterIndex > 0)) && (dialog.FilterIndex <= list.Count))
            {
                this.workflowView.SaveWorkflowImage(dialog.FileName, list[dialog.FilterIndex - 1].Format);
            }
        }
Beispiel #5
0
        protected override bool OnMouseMove(MouseEventArgs eventArgs)
        {
            WorkflowView parentView = base.ParentView;

            if (parentView == null)
            {
                throw new InvalidOperationException(DR.GetString("WorkflowViewNull", new object[0]));
            }
            bool          flag        = false;
            Point         clientPoint = new Point(eventArgs.X, eventArgs.Y);
            Point         point       = parentView.ClientPointToLogical(clientPoint);
            DesignerEdges none        = DesignerEdges.None;

            if (this.designerToResize != null)
            {
                none = this.designerSizingEdge;
                this.UpdateDesignerSize(point, this.designerToResize, this.designerSizingEdge);
                flag = true;
            }
            else if (eventArgs.Button == MouseButtons.None)
            {
                ActivityDesigner designerToResize = this.GetDesignerToResize(point, out none);
                if (((designerToResize != null) && (none != DesignerEdges.None)) && this.CanResizeDesigner(designerToResize))
                {
                    flag = true;
                }
            }
            this.UpdateCursor(none);
            return(flag);
        }
Beispiel #6
0
        private void UpdateCursor(DesignerEdges sizingEdge)
        {
            WorkflowView parentView = base.ParentView;

            if (parentView == null)
            {
                throw new InvalidOperationException(DR.GetString("WorkflowViewNull", new object[0]));
            }
            Cursor sizeNWSE = parentView.Cursor;

            if ((((sizingEdge & DesignerEdges.Left) > DesignerEdges.None) && ((sizingEdge & DesignerEdges.Top) > DesignerEdges.None)) || (((sizingEdge & DesignerEdges.Right) > DesignerEdges.None) && ((sizingEdge & DesignerEdges.Bottom) > DesignerEdges.None)))
            {
                sizeNWSE = Cursors.SizeNWSE;
            }
            else if ((((sizingEdge & DesignerEdges.Right) > DesignerEdges.None) && ((sizingEdge & DesignerEdges.Top) > DesignerEdges.None)) || (((sizingEdge & DesignerEdges.Left) > DesignerEdges.None) && ((sizingEdge & DesignerEdges.Bottom) > DesignerEdges.None)))
            {
                sizeNWSE = Cursors.SizeNESW;
            }
            else if (((sizingEdge & DesignerEdges.Top) > DesignerEdges.None) || ((sizingEdge & DesignerEdges.Bottom) > DesignerEdges.None))
            {
                sizeNWSE = Cursors.SizeNS;
            }
            else if (((sizingEdge & DesignerEdges.Left) > DesignerEdges.None) || ((sizingEdge & DesignerEdges.Right) > DesignerEdges.None))
            {
                sizeNWSE = Cursors.SizeWE;
            }
            else if ((sizingEdge == DesignerEdges.None) && (((parentView.Cursor == Cursors.SizeNWSE) || (parentView.Cursor == Cursors.SizeNESW)) || ((parentView.Cursor == Cursors.SizeNS) || (parentView.Cursor == Cursors.SizeWE))))
            {
                sizeNWSE = Cursors.Default;
            }
            if (parentView.Cursor != sizeNWSE)
            {
                parentView.Cursor = sizeNWSE;
            }
        }
        protected override bool OnMouseMove(MouseEventArgs eventArgs)
        {
            WorkflowView workflowView = ParentView;

            if (workflowView == null)
            {
                throw new InvalidOperationException(DR.GetString(DR.WorkflowViewNull));
            }

            bool          handledMessage = false;
            Point         clientPoint    = new Point(eventArgs.X, eventArgs.Y);
            Point         logicalPoint   = workflowView.ClientPointToLogical(clientPoint);
            DesignerEdges sizingEdge     = DesignerEdges.None;

            if (this.designerToResize != null)
            {
                sizingEdge = this.designerSizingEdge;
                UpdateDesignerSize(logicalPoint, this.designerToResize, this.designerSizingEdge);
                handledMessage = true;
            }
            else if (eventArgs.Button == MouseButtons.None)
            {
                ActivityDesigner designer = GetDesignerToResize(logicalPoint, out sizingEdge);
                if (designer != null && sizingEdge != DesignerEdges.None && CanResizeDesigner(designer))
                {
                    handledMessage = true;
                }
            }

            UpdateCursor(sizingEdge);
            return(handledMessage);
        }
        protected override void Initialize(Activity activity)
        {
            base.Initialize(activity);

            HelpText    = DR.GetString(DR.DropExceptionsHere);
            ShowPreview = false;
        }
Beispiel #9
0
        protected virtual void CreateDragFeedbackImages(IList <Activity> draggedActivities)
        {
            Bitmap draggedImage = null;

            if (draggedActivities.Count > 0)
            {
                Bitmap image       = null;
                String description = String.Empty;
                if (draggedActivities.Count > 1)
                {
                    image       = DR.GetImage(DR.Activities) as Bitmap;
                    description = DR.GetString(DR.ActivitiesDesc);
                }
                else
                {
                    ToolboxBitmapAttribute toolboxBitmapAttribute = (ToolboxBitmapAttribute)TypeDescriptor.GetAttributes(draggedActivities[0].GetType())[typeof(ToolboxBitmapAttribute)];
                    image       = toolboxBitmapAttribute.GetImage(draggedActivities[0].GetType()) as Bitmap;
                    description = draggedActivities[0].GetType().Name;
                }

                if (image != null && description.Length > 0)
                {
                    //Start creating a bitmap
                    WorkflowView parentView           = ParentView;
                    Rectangle    imageRectangle       = (image != null) ? new Rectangle(Point.Empty, image.Size) : Rectangle.Empty;
                    Rectangle    descriptionRectangle = (description.Length > 0) ? new Rectangle(Point.Empty, new Size(AmbientTheme.DragImageTextSize.Width, parentView.Font.Height + 2)) : Rectangle.Empty;
                    if (!imageRectangle.IsEmpty)
                    {
                        descriptionRectangle.Offset(imageRectangle.Width + AmbientTheme.DragImageMargins.Width, 0);
                    }

                    Size draggedImageSize = parentView.LogicalSizeToClient(new Size(imageRectangle.Width + descriptionRectangle.Width, Math.Max(imageRectangle.Height, descriptionRectangle.Height)));
                    draggedImage = new Bitmap(draggedImageSize.Width, draggedImageSize.Height, PixelFormat.Format32bppArgb);
                    using (Graphics draggedImageGraphics = Graphics.FromImage(draggedImage))
                        using (Brush backgroundBrush = new SolidBrush(Color.FromArgb(0, 255, 0, 255)))
                        {
                            draggedImageGraphics.ScaleTransform(ScaleZoomFactor, ScaleZoomFactor);

                            draggedImageGraphics.FillRectangle(backgroundBrush, new Rectangle(0, 0, draggedImage.Width, draggedImage.Height));
                            if (image != null)
                            {
                                draggedImageGraphics.DrawImage(image, new Rectangle(Point.Empty, image.Size));
                            }

                            if (description.Length > 0)
                            {
                                StringFormat stringFormat = new StringFormat();
                                stringFormat.Alignment     = StringAlignment.Near;
                                stringFormat.Trimming      = StringTrimming.EllipsisCharacter;
                                stringFormat.LineAlignment = StringAlignment.Center;
                                draggedImageGraphics.DrawString(description, parentView.Font, SystemBrushes.WindowText, descriptionRectangle, stringFormat);
                            }
                        }
                }
            }

            this.dragImage = draggedImage;
        }
 public TabControl(DockStyle dockStyle, AnchorAlignment stripAnchor)
 {
     if ((dockStyle == DockStyle.Fill) || (dockStyle == DockStyle.None))
     {
         throw new ArgumentException(DR.GetString("InvalidDockingStyle", new object[] { "dockStyle" }));
     }
     base.SuspendLayout();
     this.stripAnchor     = stripAnchor;
     this.Dock            = dockStyle;
     this.allowDockChange = false;
     if ((this.Dock == DockStyle.Left) || (this.Dock == DockStyle.Right))
     {
         base.Width     = SystemInformation.VerticalScrollBarWidth + 2;
         this.splitter  = new Splitter();
         this.tabStrip  = new System.Workflow.ComponentModel.Design.TabStrip(Orientation.Vertical, SystemInformation.VerticalScrollBarWidth);
         this.scrollBar = new VScrollBar();
         if (this.stripAnchor == AnchorAlignment.Near)
         {
             this.tabStrip.Dock  = DockStyle.Top;
             this.splitter.Dock  = DockStyle.Top;
             this.scrollBar.Dock = DockStyle.Fill;
         }
         else
         {
             this.tabStrip.Dock  = DockStyle.Bottom;
             this.splitter.Dock  = DockStyle.Bottom;
             this.scrollBar.Dock = DockStyle.Fill;
         }
     }
     else
     {
         base.Height    = SystemInformation.HorizontalScrollBarHeight + 2;
         this.splitter  = new Splitter();
         this.tabStrip  = new System.Workflow.ComponentModel.Design.TabStrip(Orientation.Horizontal, SystemInformation.HorizontalScrollBarHeight);
         this.scrollBar = new HScrollBar();
         if (this.stripAnchor == AnchorAlignment.Near)
         {
             this.tabStrip.Dock  = DockStyle.Left;
             this.splitter.Dock  = DockStyle.Left;
             this.scrollBar.Dock = DockStyle.Fill;
         }
         else
         {
             this.tabStrip.Dock  = DockStyle.Right;
             this.splitter.Dock  = DockStyle.Right;
             this.scrollBar.Dock = DockStyle.Fill;
         }
     }
     base.Controls.AddRange(new Control[] { this.scrollBar, this.splitter, this.tabStrip });
     this.splitter.Size         = new Size(6, 6);
     this.splitter.Paint       += new PaintEventHandler(this.OnSplitterPaint);
     this.splitter.DoubleClick += new EventHandler(this.OnSplitterDoubleClick);
     ((ItemList <System.Workflow.ComponentModel.Design.ItemInfo>) this.TabStrip.Tabs).ListChanged += new ItemListChangeEventHandler <System.Workflow.ComponentModel.Design.ItemInfo>(this.OnTabsChanged);
     this.BackColor = SystemColors.Control;
     base.ResumeLayout();
 }
Beispiel #11
0
        private void UpdateDesignerSize(Point point, ActivityDesigner designerToSize, DesignerEdges sizingEdge)
        {
            if (base.ParentView == null)
            {
                throw new InvalidOperationException(DR.GetString("WorkflowViewNull", new object[0]));
            }
            Rectangle empty = Rectangle.Empty;

            if (designerToSize.ParentDesigner != null)
            {
                empty = designerToSize.ParentDesigner.Bounds;
                Size selectionSize = WorkflowTheme.CurrentTheme.AmbientTheme.SelectionSize;
                empty.Inflate(-2 * selectionSize.Width, -2 * selectionSize.Height);
            }
            Rectangle bounds = designerToSize.Bounds;

            if ((sizingEdge & DesignerEdges.Left) > DesignerEdges.None)
            {
                int x = point.X;
                if (!empty.IsEmpty)
                {
                    x = Math.Max(x, empty.X);
                }
                x             = DesignerHelpers.SnapToGrid(new Point(x, 0)).X;
                bounds.Width += bounds.Left - x;
                int num2 = (bounds.Width < designerToSize.MinimumSize.Width) ? (bounds.Width - designerToSize.MinimumSize.Width) : 0;
                bounds.X = x + num2;
            }
            if ((sizingEdge & DesignerEdges.Top) > DesignerEdges.None)
            {
                int y = point.Y;
                if (!empty.IsEmpty)
                {
                    y = Math.Max(y, empty.Y);
                }
                y              = DesignerHelpers.SnapToGrid(new Point(0, y)).Y;
                bounds.Height += bounds.Top - y;
                int num4 = (bounds.Height < designerToSize.MinimumSize.Height) ? (bounds.Height - designerToSize.MinimumSize.Height) : 0;
                bounds.Y = y + num4;
            }
            if ((sizingEdge & DesignerEdges.Right) > DesignerEdges.None)
            {
                bounds.Width += point.X - bounds.Right;
            }
            if ((sizingEdge & DesignerEdges.Bottom) > DesignerEdges.None)
            {
                bounds.Height += point.Y - bounds.Bottom;
            }
            bounds.Width  = Math.Max(bounds.Width, designerToSize.MinimumSize.Width);
            bounds.Height = Math.Max(bounds.Height, designerToSize.MinimumSize.Height);
            if (!empty.IsEmpty)
            {
                bounds = Rectangle.Intersect(bounds, empty);
            }
            ((IWorkflowDesignerMessageSink)designerToSize).OnResizing(sizingEdge, bounds);
        }
        protected virtual void CreateDragFeedbackImages(IList <Activity> draggedActivities)
        {
            Bitmap image = null;

            if (draggedActivities.Count > 0)
            {
                Bitmap bitmap2 = null;
                string s       = string.Empty;
                if (draggedActivities.Count > 1)
                {
                    bitmap2 = DR.GetImage("Activities") as Bitmap;
                    s       = DR.GetString("ActivitiesDesc", new object[0]);
                }
                else
                {
                    ToolboxBitmapAttribute attribute = (ToolboxBitmapAttribute)TypeDescriptor.GetAttributes(draggedActivities[0].GetType())[typeof(ToolboxBitmapAttribute)];
                    bitmap2 = attribute.GetImage(draggedActivities[0].GetType()) as Bitmap;
                    s       = draggedActivities[0].GetType().Name;
                }
                if ((bitmap2 != null) && (s.Length > 0))
                {
                    WorkflowView parentView      = base.ParentView;
                    Rectangle    rectangle       = (bitmap2 != null) ? new Rectangle(Point.Empty, bitmap2.Size) : Rectangle.Empty;
                    Rectangle    layoutRectangle = (s.Length > 0) ? new Rectangle(Point.Empty, new Size(AmbientTheme.DragImageTextSize.Width, parentView.Font.Height + 2)) : Rectangle.Empty;
                    if (!rectangle.IsEmpty)
                    {
                        layoutRectangle.Offset(rectangle.Width + AmbientTheme.DragImageMargins.Width, 0);
                    }
                    Size size = parentView.LogicalSizeToClient(new Size(rectangle.Width + layoutRectangle.Width, Math.Max(rectangle.Height, layoutRectangle.Height)));
                    image = new Bitmap(size.Width, size.Height, PixelFormat.Format32bppArgb);
                    using (Graphics graphics = Graphics.FromImage(image))
                    {
                        using (Brush brush = new SolidBrush(Color.FromArgb(0, 0xff, 0, 0xff)))
                        {
                            graphics.ScaleTransform(this.ScaleZoomFactor, this.ScaleZoomFactor);
                            graphics.FillRectangle(brush, new Rectangle(0, 0, image.Width, image.Height));
                            if (bitmap2 != null)
                            {
                                graphics.DrawImage(bitmap2, new Rectangle(Point.Empty, bitmap2.Size));
                            }
                            if (s.Length > 0)
                            {
                                StringFormat format = new StringFormat {
                                    Alignment     = StringAlignment.Near,
                                    Trimming      = StringTrimming.EllipsisCharacter,
                                    LineAlignment = StringAlignment.Center
                                };
                                graphics.DrawString(s, parentView.Font, SystemBrushes.WindowText, layoutRectangle, format);
                            }
                        }
                    }
                }
            }
            this.dragImage = image;
        }
Beispiel #13
0
        public static string GenerateThemeFilePath()
        {
            string lookupPath = LookupPath;
            string path       = Path.Combine(lookupPath, DR.GetString("MyFavoriteTheme", new object[0]) + ".wtm");

            for (int i = 1; File.Exists(path); i++)
            {
                path = Path.Combine(lookupPath, DR.GetString("MyFavoriteTheme", new object[0]) + i.ToString(CultureInfo.InvariantCulture) + ".wtm");
            }
            return(path);
        }
        protected override void OnBeginPrint(PrintEventArgs printArgs)
        {
            base.OnBeginPrint(printArgs);
            this.currentPrintablePage = Point.Empty;
            bool flag = (base.PrinterSettings.IsValid && (PrinterSettings.InstalledPrinters.Count > 0)) && new ArrayList(PrinterSettings.InstalledPrinters).Contains(base.PrinterSettings.PrinterName);

            if (!flag)
            {
                DesignerHelpers.ShowError(this.workflowView, DR.GetString("SelectedPrinterIsInvalidErrorMessage", new object[0]));
            }
            printArgs.Cancel = !flag || (this.workflowView.RootDesigner == null);
        }
 public ActivityDesignerAccessibleObject(System.Workflow.ComponentModel.Design.ActivityDesigner activityDesigner)
 {
     if (activityDesigner == null)
     {
         throw new ArgumentNullException("activityDesigner");
     }
     if (activityDesigner.Activity == null)
     {
         throw new ArgumentException(DR.GetString("DesignerNotInitialized", new object[0]), "activityDesigner");
     }
     this.activityDesigner = activityDesigner;
 }
Beispiel #16
0
        internal void RefreshTargetWorkflowType()
        {
            if (Activity == null)
            {
                return;
            }

            ITypeFilterProvider typeFilterProvider = Activity as ITypeFilterProvider;
            Type workflowType = Activity.GetType().InvokeMember("TargetWorkflow", BindingFlags.GetProperty | BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.Instance | BindingFlags.FlattenHierarchy | BindingFlags.ExactBinding, null, Activity, new object[] { }, CultureInfo.InvariantCulture) as Type;

            if (workflowType != null && typeFilterProvider.CanFilterType(workflowType, false))
            {
                ITypeProvider typeProvider = (ITypeProvider)GetService(typeof(ITypeProvider));
                if (typeProvider != null)
                {
                    Type updatedWorkflowType = null;
                    if (workflowType.Assembly == null && typeProvider.LocalAssembly != null)
                    {
                        updatedWorkflowType = typeProvider.LocalAssembly.GetType(workflowType.FullName);
                    }
                    else
                    {
                        updatedWorkflowType = typeProvider.GetType(workflowType.FullName);
                    }

                    if (updatedWorkflowType != null)
                    {
                        workflowType = updatedWorkflowType;
                    }
                }
            }
            else
            {
                workflowType = null;
            }

            if (this.targetWorkflowType != workflowType)
            {
                this.targetWorkflowType = workflowType;
                RefreshHostedActivity();

                if (this.targetWorkflowType is DesignTimeType)
                {
                    HelpText = DR.GetString(DR.BuildTargetWorkflow);
                }
                else
                {
                    HelpText = DR.GetString(DR.SpecifyTargetWorkflow);
                }
            }

            TypeDescriptor.Refresh(Activity);
        }
 public void BringToFront(ActivityDesigner containedDesigner)
 {
     if (containedDesigner == null)
     {
         throw new ArgumentNullException("containedDesigner");
     }
     if (!this.ContainedDesigners.Contains(containedDesigner))
     {
         throw new ArgumentException(DR.GetString("InvalidDesignerSpecified", new object[] { "containedDesigner" }));
     }
     this.UpdateZOrder(containedDesigner, ZOrder.Foreground);
 }
        private void SetResizableDesigner(ActivityDesigner designer, DesignerEdges sizingEdge)
        {
            if (this.designerToResize == designer)
            {
                return;
            }

            if (designer != null && !CanResizeDesigner(designer))
            {
                Debug.Assert(false);
                return;
            }

            WorkflowView workflowView = ParentView;

            if (workflowView == null)
            {
                throw new InvalidOperationException(DR.GetString(DR.WorkflowViewNull));
            }

            if (designer != null)
            {
                if (this.designerTransaction != null)
                {
                    this.designerTransaction.Cancel();
                }

                IDesignerHost designerHost = GetService(typeof(IDesignerHost)) as IDesignerHost;
                if (designerHost != null)
                {
                    this.designerTransaction = designerHost.CreateTransaction(DR.GetString(DR.ResizeUndoDescription, designer.Text));
                }

                ((IWorkflowDesignerMessageSink)designer).OnBeginResizing(sizingEdge);
            }
            else
            {
                if (this.designerTransaction != null)
                {
                    this.designerTransaction.Commit();
                    this.designerTransaction = null;
                }

                ((IWorkflowDesignerMessageSink)this.designerToResize).OnEndResizing();
            }

            this.designerToResize   = designer;
            this.designerSizingEdge = sizingEdge;

            workflowView.Capture = (this.designerToResize != null);
            UpdateCursor(this.designerSizingEdge);
        }
Beispiel #19
0
        private void OnPropertyGridAdornments(ITypeDescriptorContext context, PropertyDescriptor propDesc, ArrayList valueUIItemList)
        {
            IComponent        component        = null;
            IReferenceService referenceService = this.serviceProvider.GetService(typeof(IReferenceService)) as IReferenceService;

            if (referenceService != null)
            {
                component = referenceService.GetComponent(context.Instance);
            }

            string fullAliasName = string.Empty;
            //this attribue is set to overcome issue with the TypedVariableDeclarationTypeConverter
            //not returning Name property at all. we alias that property to the VariableDeclaration itself
            DefaultPropertyAttribute aliasPropertyNameAttribute = propDesc.Attributes[typeof(DefaultPropertyAttribute)] as DefaultPropertyAttribute;

            if (aliasPropertyNameAttribute != null && aliasPropertyNameAttribute.Name != null && aliasPropertyNameAttribute.Name.Length > 0)
            {
                fullAliasName = propDesc.Name + "." + aliasPropertyNameAttribute.Name;
            }

            if (component != null)
            {
                ActivityDesigner activityDesigner = ActivityDesigner.GetDesigner(component as Activity);
                if (activityDesigner != null)
                {
                    if (!activityDesigner.IsLocked && ActivityBindPropertyDescriptor.IsBindableProperty(propDesc) && !propDesc.IsReadOnly)
                    {
                        valueUIItemList.Add(new PropertyValueUIItem(DR.GetImage(DR.Bind), OnBindProperty, DR.GetString(DR.BindProperty)));
                    }

                    string fullComponentName = referenceService.GetName(component);        //schedule1.send1
                    string fullPropertyName  = referenceService.GetName(context.Instance); //schedule1.send1.message
                    fullPropertyName = (fullPropertyName.Length > fullComponentName.Length) ? fullPropertyName.Substring(fullComponentName.Length + 1, fullPropertyName.Length - fullComponentName.Length - 1) + "." + propDesc.Name : string.Empty;

                    foreach (DesignerAction action in activityDesigner.DesignerActions)
                    {
                        string actionPropertyName = action.PropertyName as string;
                        if (actionPropertyName == null || actionPropertyName.Length == 0)
                        {
                            continue;
                        }

                        if (actionPropertyName == propDesc.Name || (actionPropertyName == fullPropertyName) || (actionPropertyName == fullAliasName))
                        {
                            PropertyValueUIItemHandler propValueUIItemhandler = new PropertyValueUIItemHandler(action);
                            valueUIItemList.Add(new PropertyValueUIItem(action.Image, propValueUIItemhandler.OnFixPropertyError, action.Text));
                            break;
                        }
                    }
                }
            }
        }
Beispiel #20
0
 private void OnItemsChanging(object sender, ItemListChangeEventArgs <System.Workflow.ComponentModel.Design.ItemInfo> e)
 {
     if (e.Action == ItemListChangeAction.Add)
     {
         foreach (System.Workflow.ComponentModel.Design.ItemInfo info in e.AddedItems)
         {
             if (this.tabItemList.Contains(info))
             {
                 throw new ArgumentException(DR.GetString("Error_TabExistsWithSameId", new object[0]));
             }
         }
     }
 }
        /// <summary>
        /// Constructs the accessibility class for ActivityDesigner
        /// </summary>
        /// <param name="activityDesigner">ActivityDesigner associated with accessiblity object</param>
        public ActivityDesignerAccessibleObject(ActivityDesigner activityDesigner)
        {
            if (activityDesigner == null)
            {
                throw new ArgumentNullException("activityDesigner");
            }
            if (activityDesigner.Activity == null)
            {
                throw new ArgumentException(DR.GetString(DR.DesignerNotInitialized), "activityDesigner");
            }

            this.activityDesigner = activityDesigner;
        }
 public void ResizeContainedDesigner(ActivityDesigner containedDesigner, Size newSize)
 {
     if (containedDesigner == null)
     {
         throw new ArgumentNullException("containedDesigner");
     }
     if (!this.ContainedDesigners.Contains(containedDesigner))
     {
         throw new ArgumentException(DR.GetString("InvalidDesignerSpecified", new object[] { "containedDesigner" }));
     }
     SetDesignerBounds(containedDesigner, new Rectangle(containedDesigner.Location, newSize));
     base.PerformLayout();
 }
        internal static void ShowHelpFromKeyword(IServiceProvider serviceProvider, string helpKeyword)
        {
            IHelpService service = serviceProvider.GetService(typeof(IHelpService)) as IHelpService;

            if (service != null)
            {
                service.ShowHelpFromKeyword(helpKeyword);
            }
            else
            {
                ShowError(serviceProvider, DR.GetString("NoHelpAvailable", new object[0]));
            }
        }
Beispiel #24
0
 protected override bool OnMouseUp(MouseEventArgs eventArgs)
 {
     if ((this.designerToResize != null) && (eventArgs.Button == MouseButtons.Left))
     {
         WorkflowView parentView = base.ParentView;
         if (parentView == null)
         {
             throw new InvalidOperationException(DR.GetString("WorkflowViewNull", new object[0]));
         }
         this.UpdateDesignerSize(parentView.ClientPointToLogical(new Point(eventArgs.X, eventArgs.Y)), this.designerToResize, this.designerSizingEdge);
     }
     this.SetResizableDesigner(null, DesignerEdges.None);
     return(false);
 }
Beispiel #25
0
        private Rectangle GetTabItemRectangle(System.Workflow.ComponentModel.Design.ItemInfo tabItemInfo)
        {
            int index = this.tabItemList.IndexOf(tabItemInfo);

            if (index < 0)
            {
                throw new ArgumentException(DR.GetString("ButtonInformationMissing", new object[0]));
            }
            if (this.drawItems.Length == this.tabItemList.Count)
            {
                return(this.drawItems[index].TabItemRectangle);
            }
            return(Rectangle.Empty);
        }
        internal void AddObject(object value)
        {
            if (this.serializedXmlString != null)
            {
                throw new InvalidOperationException(DR.GetString("InvalidOperationStoreAlreadyClosed", new object[0]));
            }
            Activity item = value as Activity;

            if (item == null)
            {
                throw new ArgumentException("value");
            }
            this.activities.Add(item);
        }
Beispiel #27
0
 public ConnectionPoint(ActivityDesigner associatedDesigner, DesignerEdges designerEdge, int connectionIndex)
 {
     if (associatedDesigner == null)
     {
         throw new ArgumentNullException("associatedDesigner");
     }
     if ((connectionIndex < 0) || (connectionIndex >= associatedDesigner.GetConnections(designerEdge).Count))
     {
         throw new ArgumentException(DR.GetString("Error_ConnectionPoint", new object[0]), "connectionIndex");
     }
     this.associatedDesigner = associatedDesigner;
     this.designerEdge       = designerEdge;
     this.connectionIndex    = connectionIndex;
 }
Beispiel #28
0
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            OpenFileDialog dialog = new OpenFileDialog {
                AddExtension    = true,
                DefaultExt      = "*.wtm",
                CheckFileExists = true,
                Filter          = DR.GetString("ImageFileFilter", new object[0])
            };

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                return(dialog.FileName);
            }
            return(value);
        }
        protected override bool OnMouseUp(MouseEventArgs eventArgs)
        {
            if (this.designerToResize != null && eventArgs.Button == MouseButtons.Left)
            {
                WorkflowView workflowView = ParentView;
                if (workflowView == null)
                {
                    throw new InvalidOperationException(DR.GetString(DR.WorkflowViewNull));
                }

                UpdateDesignerSize(workflowView.ClientPointToLogical(new Point(eventArgs.X, eventArgs.Y)), this.designerToResize, this.designerSizingEdge);
            }
            SetResizableDesigner(null, DesignerEdges.None);
            return(false);
        }
 private void OnMenuPageSetup(object sender, EventArgs e)
 {
     if (PrinterSettings.InstalledPrinters.Count < 1)
     {
         DesignerHelpers.ShowError(this.serviceProvider, DR.GetString("ThereIsNoPrinterInstalledErrorMessage", new object[0]));
     }
     else
     {
         WorkflowPageSetupDialog dialog = new WorkflowPageSetupDialog(this.serviceProvider);
         if (DialogResult.OK == dialog.ShowDialog())
         {
             this.workflowView.PerformLayout(false);
         }
     }
 }