protected override void Dispose(bool disposing)
 {
     try
     {
         if (disposing)
         {
             this.containedRootDesigner = null;
             this.containedLoader = null;
             if (this.containedDesignSurface != null)
             {
                 this.containedDesignSurface.Dispose();
                 this.containedDesignSurface = null;
             }
             if (this.lastInvokedWorkflowState != null)
             {
                 this.lastInvokedWorkflowState.Close();
                 this.lastInvokedWorkflowState = null;
             }
         }
     }
     finally
     {
         base.Dispose(disposing);
     }
 }
        protected void RefreshHostedActivity()
        {
            // get currest state
            if (this.containedRootDesigner != null)
            {
                this.lastInvokedWorkflowState = new MemoryStream();
                BinaryWriter writer = new BinaryWriter(this.lastInvokedWorkflowState);
                SaveViewState(writer);
            }

            //Refresh the designer
            this.containedRootDesigner = LoadHostedWorkflow();
            if (this.lastInvokedWorkflowState != null)
            {
                // set state
                this.lastInvokedWorkflowState.Position = 0;
                BinaryReader reader = new BinaryReader(this.lastInvokedWorkflowState);
                try
                {
                    LoadViewState(reader);
                }
                catch
                {
                    // tried to apply serialized state to the wrong hosted activity... ignore 
                }
            }

            PerformLayout();
        }
示例#3
0
        protected void RefreshHostedActivity()
        {
            // get currest state
            if (this.containedRootDesigner != null)
            {
                this.lastInvokedWorkflowState = new MemoryStream();
                BinaryWriter writer = new BinaryWriter(this.lastInvokedWorkflowState);
                SaveViewState(writer);
            }

            //Refresh the designer
            this.containedRootDesigner = LoadHostedWorkflow();
            if (this.lastInvokedWorkflowState != null)
            {
                // set state
                this.lastInvokedWorkflowState.Position = 0;
                BinaryReader reader = new BinaryReader(this.lastInvokedWorkflowState);
                try
                {
                    LoadViewState(reader);
                }
                catch
                {
                    // tried to apply serialized state to the wrong hosted activity... ignore
                }
            }

            PerformLayout();
        }
示例#4
0
 protected override void Dispose(bool disposing)
 {
     try
     {
         if (disposing)
         {
             //Both of these objects are disposed in design surface dispose.
             this.containedRootDesigner = null;
             this.containedLoader       = null;
             if (this.containedDesignSurface != null)
             {
                 this.containedDesignSurface.Dispose();
                 this.containedDesignSurface = null;
             }
             if (this.lastInvokedWorkflowState != null)
             {
                 this.lastInvokedWorkflowState.Close();
                 this.lastInvokedWorkflowState = null;
             }
         }
     }
     finally
     {
         base.Dispose(disposing);
     }
 }
示例#5
0
        private void LoadDesignerLayoutFromResource(out IList layoutErrors)
        {
            layoutErrors = null;
            IWorkflowRootDesigner safeRootDesigner = ActivityDesigner.GetSafeRootDesigner(base.LoaderHost);

            if ((safeRootDesigner != null) && safeRootDesigner.SupportsLayoutPersistence)
            {
                Type   type = safeRootDesigner.Component.GetType();
                string manifestResourceName = type.Name + ".layout";
                this.LoadDesignerLayoutFromResource(type, manifestResourceName, out layoutErrors);
            }
        }
            protected override IDesigner CreateDesigner(IComponent component, bool rootDesigner)
            {
                IDesigner designer = base.CreateDesigner(component, rootDesigner);

                if (rootDesigner)
                {
                    IWorkflowRootDesigner designer2 = designer as IWorkflowRootDesigner;
                    if (designer2 != null)
                    {
                        designer2.InvokingDesigner = this.parentDesigner;
                    }
                }
                return(designer);
            }
示例#7
0
        private void LoadDesignerLayoutFromResource(out IList layoutErrors)
        {
            layoutErrors = null;

            IWorkflowRootDesigner rootDesigner = ActivityDesigner.GetSafeRootDesigner(LoaderHost);

            if (rootDesigner == null || !rootDesigner.SupportsLayoutPersistence)
            {
                return;
            }

            Type   rootActivityType = rootDesigner.Component.GetType();
            string resourceName     = rootActivityType.Name + WorkflowDesignerLoader.DesignerLayoutFileExtension;

            LoadDesignerLayoutFromResource(rootActivityType, resourceName, out layoutErrors);
        }
示例#8
0
        private void LoadDesignerLayout(out IList layoutErrors)
        {
            layoutErrors = null;
            string designerLayoutFileName          = this.DesignerLayoutFileName;
            IWorkflowRootDesigner safeRootDesigner = ActivityDesigner.GetSafeRootDesigner(base.LoaderHost);

            if (((safeRootDesigner != null) && safeRootDesigner.SupportsLayoutPersistence) && File.Exists(designerLayoutFileName))
            {
                using (TextReader reader = this.GetFileReader(designerLayoutFileName))
                {
                    if (reader != null)
                    {
                        using (XmlReader reader2 = XmlReader.Create(reader))
                        {
                            this.LoadDesignerLayout(reader2, out layoutErrors);
                        }
                    }
                }
            }
        }
 protected override void LoadViewState(BinaryReader reader)
 {
     base.LoadViewState(reader);
     if (reader.ReadBoolean())
     {
         if (this.containedDesignSurface == null)
         {
             this.containedRootDesigner = this.LoadHostedWorkflow();
         }
         if (this.containedDesignSurface != null)
         {
             IDesignerHost service = this.containedDesignSurface.GetService(typeof(IDesignerHost)) as IDesignerHost;
             if (service == null)
             {
                 throw new Exception(SR.GetString("General_MissingService", new object[] { typeof(IDesignerHost).FullName }));
             }
             DesignerHelpers.DeserializeDesignerStates(service, reader);
         }
     }
 }
 protected override void LoadViewState(BinaryReader reader)
 {
     base.LoadViewState(reader);
     if (reader.ReadBoolean())
     {
         if (this.containedDesignSurface == null)
         {
             this.containedRootDesigner = this.LoadHostedWorkflow();
         }
         if (this.containedDesignSurface != null)
         {
             IDesignerHost service = this.containedDesignSurface.GetService(typeof(IDesignerHost)) as IDesignerHost;
             if (service == null)
             {
                 throw new Exception(SR.GetString("General_MissingService", new object[] { typeof(IDesignerHost).FullName }));
             }
             DesignerHelpers.DeserializeDesignerStates(service, reader);
         }
     }
 }
示例#11
0
        private void LoadDesignerLayout(out IList layoutErrors)
        {
            layoutErrors = null;

            string layoutFileName = DesignerLayoutFileName;
            IWorkflowRootDesigner rootDesigner = ActivityDesigner.GetSafeRootDesigner(LoaderHost);

            if (rootDesigner == null || !rootDesigner.SupportsLayoutPersistence || !File.Exists(layoutFileName))
            {
                return;
            }

            using (TextReader layoutReader = GetFileReader(layoutFileName))
            {
                if (layoutReader != null)
                {
                    using (XmlReader xmlReader = XmlReader.Create(layoutReader))
                        LoadDesignerLayout(xmlReader, out layoutErrors);
                }
            }
        }
示例#12
0
        protected override void LoadViewState(BinaryReader reader)
        {
            base.LoadViewState(reader);

            if (reader.ReadBoolean())
            {
                //verify the hosted surface and designer are loaded
                if (this.containedDesignSurface == null)
                {
                    this.containedRootDesigner = LoadHostedWorkflow();
                }

                if (this.containedDesignSurface != null)
                {
                    IDesignerHost designerHost = this.containedDesignSurface.GetService(typeof(IDesignerHost)) as IDesignerHost;
                    if (designerHost == null)
                    {
                        throw new Exception(SR.GetString(SR.General_MissingService, typeof(IDesignerHost).FullName));
                    }
                    DesignerHelpers.DeserializeDesignerStates(designerHost, reader);
                }
            }
        }
 protected void RefreshHostedActivity()
 {
     if (this.containedRootDesigner != null)
     {
         this.lastInvokedWorkflowState = new MemoryStream();
         BinaryWriter writer = new BinaryWriter(this.lastInvokedWorkflowState);
         this.SaveViewState(writer);
     }
     this.containedRootDesigner = this.LoadHostedWorkflow();
     if (this.lastInvokedWorkflowState != null)
     {
         this.lastInvokedWorkflowState.Position = 0L;
         BinaryReader reader = new BinaryReader(this.lastInvokedWorkflowState);
         try
         {
             this.LoadViewState(reader);
         }
         catch
         {
         }
     }
     base.PerformLayout();
 }
        protected override void LoadViewState(BinaryReader reader)
        {
            base.LoadViewState(reader);

            if (reader.ReadBoolean())
            {
                //verify the hosted surface and designer are loaded
                if (this.containedDesignSurface == null)
                    this.containedRootDesigner = LoadHostedWorkflow();

                if (this.containedDesignSurface != null)
                {
                    IDesignerHost designerHost = this.containedDesignSurface.GetService(typeof(IDesignerHost)) as IDesignerHost;
                    if (designerHost == null)
                        throw new Exception(SR.GetString(SR.General_MissingService, typeof(IDesignerHost).FullName));
                    DesignerHelpers.DeserializeDesignerStates(designerHost, reader);
                }
            }
        }
 protected void RefreshHostedActivity()
 {
     if (this.containedRootDesigner != null)
     {
         this.lastInvokedWorkflowState = new MemoryStream();
         BinaryWriter writer = new BinaryWriter(this.lastInvokedWorkflowState);
         this.SaveViewState(writer);
     }
     this.containedRootDesigner = this.LoadHostedWorkflow();
     if (this.lastInvokedWorkflowState != null)
     {
         this.lastInvokedWorkflowState.Position = 0L;
         BinaryReader reader = new BinaryReader(this.lastInvokedWorkflowState);
         try
         {
             this.LoadViewState(reader);
         }
         catch
         {
         }
     }
     base.PerformLayout();
 }