Beispiel #1
0
        /// <summary>
        /// 获取工作流持久化的实例
        /// </summary>
        /// <returns></returns>
        private InstanceStore GetInstanceStore()
        {
            InstanceStore instanceStore = new SqlWorkflowInstanceStore(m_ConnectionString);
            InstanceView  view          = instanceStore.Execute
                                              (instanceStore.CreateInstanceHandle(),
                                              new CreateWorkflowOwnerCommand(),
                                              TimeSpan.FromSeconds(30));

            instanceStore.DefaultInstanceOwner = view.InstanceOwner;
            return(instanceStore);
        }
 protected internal override void Validate(InstanceView view)
 {
     if (!view.IsBoundToInstanceOwner)
     {
         throw FxTrace.Exception.AsError(new InvalidOperationException(SR.OwnerRequired));
     }
     if (view.IsBoundToInstance)
     {
         throw FxTrace.Exception.AsError(new InvalidOperationException(SR.AlreadyBoundToInstance));
     }
 }
 protected internal override void Validate(InstanceView view)
 {
     if (!view.IsBoundToInstanceOwner)
     {
         this.instanceOwnerMetadata.ValidatePropertyBag();
         return;
     }
     else
     {
         throw FxTrace.Exception.AsError(new InvalidOperationException(SRCore.AlreadyBoundToOwner));
     }
 }
Beispiel #4
0
        /// <summary>
        /// Converts the specific Activity type to the base activity type instance for execution.
        /// </summary>
        /// <param name="subscriber"></param>
        /// <returns></returns>
        /// <exception cref="ArgumentNullException"></exception>
        public static Activity GetActivity(this InstanceView instance)
        {
            if (instance.IdentityName == null)
            {
                throw new ArgumentNullException("instance.IdentityName");
            }

            //This may need to be revisted depending on where the workflows are.
            var assembly = GetAssemblyByName(instance.IdentityPackage);

            return((Activity)assembly.CreateInstance(instance.IdentityName));
        }
Beispiel #5
0
        private static void SetupInstanceStore()
        {
            instanceStore =
                new SqlWorkflowInstanceStore(@"Data Source=.\SQLEXPRESS;Initial Catalog=SampleInstanceStore;Integrated Security=True;Asynchronous Processing=True");

            InstanceHandle handle = instanceStore.CreateInstanceHandle();
            InstanceView   view   = instanceStore.Execute(handle, new CreateWorkflowOwnerCommand(), TimeSpan.FromSeconds(30));

            handle.Free();

            instanceStore.DefaultInstanceOwner = view.InstanceOwner;
        }
Beispiel #6
0
        protected internal override void Validate(InstanceView view)
        {
            if (!view.IsBoundToInstance)
            {
                throw Microsoft.CoreWf.Internals.FxTrace.Exception.AsError(new InvalidOperationException(SRCore.InstanceRequired));
            }

            if (!view.IsBoundToInstanceOwner)
            {
                throw Microsoft.CoreWf.Internals.FxTrace.Exception.AsError(new InvalidOperationException(SRCore.OwnerRequired));
            }
        }
Beispiel #7
0
 private static void DeleteInstanceStoreOwner()
 {
     try
     {
         InstanceHandle handle = instanceStore.CreateInstanceHandle();
         InstanceView   view   = instanceStore.Execute(handle, new DeleteWorkflowOwnerCommand(), TimeSpan.FromSeconds(30));
         handle.Free();
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Beispiel #8
0
        private static InstanceStore CreateInstanceStore()
        {
            string connectionString = ConfigurationManager.ConnectionStrings
                                      ["InstanceStore"].ConnectionString;
            InstanceStore store =
                new SqlWorkflowInstanceStore(connectionString);
            InstanceView view = store.Execute(
                store.CreateInstanceHandle(),
                new CreateWorkflowOwnerCommand(),
                TimeSpan.FromSeconds(30));

            store.DefaultInstanceOwner = view.InstanceOwner;
            return(store);
        }
Beispiel #9
0
        public WorkflowInstance LoadWorkflow(Guid instanceId)
        {
            var instance = this._repository.LoadWorkflowInstance(instanceId);
            var activity = Helpers.LoadWorkflowActiovityFromXaml(this._workflowRepositoryPath + instance.WorkflowName, this._errorLogger);

            if (activity != null)
            {
                WorkflowApplication app = new WorkflowApplication(activity);
                app.Extensions.Add(() =>
                {
                    SQLTrackingPaticipant participant = new SQLTrackingPaticipant();
                    participant.ConnectionString      = _connectionString;
                    participant.TrackingProfile       = CreateTrackingProfile();
                    return(participant);
                });
                if (this._isPersistable)
                {
                    //setup persistence
                    InstanceStore store = new SqlWorkflowInstanceStore(
                        this._connectionString);
                    InstanceHandle handle = store.CreateInstanceHandle();
                    InstanceView   view   = store.Execute(handle,
                                                          new CreateWorkflowOwnerCommand(), TimeSpan.FromSeconds(30));
                    handle.Free();
                    store.DefaultInstanceOwner = view.InstanceOwner;
                    app.InstanceStore          = store;
                    app.PersistableIdle        = (e) => { return(PersistableIdleAction.Persist); };
                }
                try
                {
                    app.Load(instanceId);
                    app.Run();

                    instance.SetApplicationhost(app);
                    instance.SetWorkflowInstanceHandeler(this);

                    instance.State      = InstanceState.Loaded;
                    instance.InstanceId = instanceId;
                    this._managedWorkflows.Add(instance);
                    this._repository.UpdateWorkflowInstanceState(app.Id, InstanceState.Loaded, instance.Bookmarks.ConvertStringListToCommaSeparatedString());

                    return(instance);
                }
                catch (Exception ex)
                {
                    this._errorLogger.Log(ex.Message, LoggerInfoTypes.Error);
                }
            }
            return(null);
        }
        private void ReadSuspendedInfo(InstanceView view)
        {
            string str = null;

            if (TryGetValue <string>(view.InstanceMetadata, WorkflowServiceNamespace.SuspendReason, out str))
            {
                this.IsSuspended     = true;
                this.SuspendedReason = str;
            }
            else
            {
                this.IsSuspended     = false;
                this.SuspendedReason = null;
            }
        }
Beispiel #11
0
        public void ResumeWorkFlow(BusinessObject.DtoModels.Game game)
        {
            Exception exception = new Exception();

            Guid workflowInstanceID = game.InstanceId;

            SqlWorkflowInstanceStore store = new SqlWorkflowInstanceStore(databaseConnection);

            store.InstanceLockedExceptionAction = InstanceLockedExceptionAction.BasicRetry;
            store.HostLockRenewalPeriod         = TimeSpan.FromSeconds(2);


            InstanceHandle             instanceHandle = store.CreateInstanceHandle();
            CreateWorkflowOwnerCommand createOwnerCmd = new CreateWorkflowOwnerCommand();
            InstanceView view = store.Execute(instanceHandle, createOwnerCmd, TimeSpan.FromSeconds(10));

            store.DefaultInstanceOwner = view.InstanceOwner;

            WorkflowApplicationInstance instance = WorkflowApplication.GetInstance(workflowInstanceID, store);

            AutoResetEvent syncEvent = new AutoResetEvent(false);

            WorkflowApplication wfApplication = new WorkflowApplication(new FlowchartNumberGuessWorkflow(), instance.DefinitionIdentity);

            wfApplication.PersistableIdle      = (e) => PersistableIdleAction.Unload;
            wfApplication.Unloaded             = (e) => { syncEvent.Set(); };
            wfApplication.OnUnhandledException = (e) =>
            {
                exception = e.UnhandledException;
                syncEvent.Set();
                return(UnhandledExceptionAction.Cancel);
            };

            wfApplication.Load(instance);

            BookmarkResumptionResult result = wfApplication.ResumeBookmark("Decision", game);

            syncEvent.WaitOne();

            if (exception.Message != string.Empty && exception.StackTrace != null)
            {
                throw exception;
            }

            DeleteWorkflowOwnerCommand deleteOwnerCmd = new DeleteWorkflowOwnerCommand();

            store.Execute(instanceHandle, deleteOwnerCmd, TimeSpan.FromSeconds(10));
        }
        private void _btnLog_Click(object sender, RoutedEventArgs e)
        {
            Button btnLog = (Button)sender;

            InstanceView       iv  = (InstanceView)btnLog.DataContext;
            ServiceHistoryView shv = new ServiceHistoryView()
            {
                AccountID   = iv.AccountID,
                ServiceName = iv.ServiceName,
                InstanceID  = int.Parse(iv.InstanceID),
                Outcome     = iv.Outcome
            };
            Log l = new Log(shv);

            l.Show();
        }
Beispiel #13
0
        public WorkflowApplicationInstance GetInstance(Guid workflowInstanceID)
        {
            SqlWorkflowInstanceStore store = new SqlWorkflowInstanceStore(databaseConnection);

            store.InstanceLockedExceptionAction = InstanceLockedExceptionAction.BasicRetry;
            store.HostLockRenewalPeriod         = TimeSpan.FromSeconds(2);


            InstanceHandle             instanceHandle = store.CreateInstanceHandle();
            CreateWorkflowOwnerCommand createOwnerCmd = new CreateWorkflowOwnerCommand();
            InstanceView view = store.Execute(instanceHandle, createOwnerCmd, TimeSpan.FromSeconds(10));

            store.DefaultInstanceOwner = view.InstanceOwner;

            return(WorkflowApplication.GetInstance(workflowInstanceID, store));
        }
Beispiel #14
0
        public InstanceView InsertInstance(Instance instance)
        {
            InstanceView instanceView = new InstanceView();
            bool         result       = false;
            Template     template     = null;

            template = this.templateRepositories.GetOneTemplate(instance.Template, instance.Type);
            if (template == null || String.IsNullOrEmpty(template.Name) || instance.Name == null)
            {
                result = false;
            }
            else
            {
                Instance ins = this.instanceRepositories.GetOneInstance(instance.Name, template.Type);
                if (ins == null)
                {
                    result = true;
                    Instance instancedata = new Instance();
                    instancedata.Name     = instance.Name;
                    instancedata.Template = template.Name;
                    instancedata.Type     = template.Type;
                    result = this.instanceRepositories.CreateInstance(instancedata);
                }
                else
                {
                    result = false;
                    instanceView.StatusCode = REPETITION;
                    return(instanceView);
                }
            }

            if (result)
            {
                instanceView.StatusCode = SUCCESS;
                Instance        ins       = this.instanceRepositories.GetOneInstance(instance.Name, instance.Type);
                List <Instance> instances = new List <Instance>();
                instances.Add(ins);
                instanceView.Data = instances;
                return(instanceView);
            }
            else
            {
                instanceView.StatusCode = FAILTURE;
            }

            return(instanceView);
        }
Beispiel #15
0
        public InstanceView UpdateIntance(Instance instance)
        {
            InstanceView instanceView = new InstanceView();
            bool         result       = false;

            //find template first
            Template template = templateRepositories.GetOneTemplate(instance.Template, string.Empty);
            Instance ins      = this.instanceRepositories.GetOneInstance(instance.Name, instance.Type);

            if (template == null)
            {
                result = false;
            }
            else
            {
                if (ins == null || ins.Id == instance.Id)
                {
                    Debug.WriteLine(ins);
                    instance.Template = template.Name;
                    instance.Type     = template.Type;
                    result            = instanceRepositories.Update(instance);
                    Debug.Write("insertfail null");
                }
                else
                {
                    instanceView.StatusCode = REPETITION;
                    List <Instance> instances = new List <Instance>();
                    instances.Add(instance);
                    instanceView.Data = instances;
                    return(instanceView);
                }
            }


            if (result)
            {
                List <Instance> instances = new List <Instance>();
                instances.Add(instance);
                instanceView.Data       = instances;
                instanceView.StatusCode = SUCCESS;
            }
            else
            {
                instanceView.StatusCode = FAILTURE;
            }
            return(instanceView);
        }
Beispiel #16
0
        /// <summary>
        /// 加载工作流
        /// </summary>
        /// <param name="id">工作流的唯一标示</param>
        /// <param name="bookMark">标签名称</param>
        /// <param name="ids">恢复指定名称的书签的时候,传入的参数</param>
        /// <returns>工作流的加载的状态</returns>
        public string Load(string id, object inputs = null)
        {
            _instanceStore = new SqlWorkflowInstanceStore(connectionString);
            InstanceView view = _instanceStore.Execute
                                    (_instanceStore.CreateInstanceHandle(),
                                    new CreateWorkflowOwnerCommand(),
                                    TimeSpan.FromSeconds(30));

            _instanceStore.DefaultInstanceOwner = view.InstanceOwner;

            WorkflowApplication i = new WorkflowApplication(ActivityXamlServices.Load(path));

            i.InstanceStore   = _instanceStore;
            i.PersistableIdle = (waiea) => PersistableIdleAction.Unload;
            i.Load(new Guid(id));
            return(i.ResumeBookmark(bookMark, inputs).GetString());
        }
Beispiel #17
0
        public void InitWorkflowApplication()
        {
            instanceStore = new SqlWorkflowInstanceStore(connStr);
            view          = instanceStore.Execute(instanceStore.CreateInstanceHandle(), new CreateWorkflowOwnerCommand(), TimeSpan.FromSeconds(30));
            instanceStore.DefaultInstanceOwner = view.InstanceOwner;
            instance.InstanceStore             = instanceStore;

            instance.Idle = delegate(WorkflowApplicationIdleEventArgs e)
            {
                idleEvent.Set();
            };

            instance.Completed = delegate(WorkflowApplicationCompletedEventArgs e)
            {
                idleEvent.Set();
            };
        }
Beispiel #18
0
 protected internal override void Validate(InstanceView view)
 {
     if (view.IsBoundToInstanceOwner)
     {
         if (!view.IsBoundToInstance)
         {
             if (this.LookupInstanceKey != Guid.Empty)
             {
                 if (this.AssociateInstanceKeyToInstanceId != Guid.Empty)
                 {
                     if (!this.AcceptUninitializedInstance)
                     {
                         throw FxTrace.Exception.AsError(new InvalidOperationException(SRCore.LoadOpFreeKeyRequiresAcceptUninitialized));
                     }
                 }
                 else
                 {
                     if (this.InstanceKeysToAssociate.ContainsKey(this.LookupInstanceKey))
                     {
                         throw FxTrace.Exception.AsError(new InvalidOperationException(SRCore.LoadOpAssociateKeysCannotContainLookupKey));
                     }
                 }
                 if (this.keysToAssociate != null)
                 {
                     foreach (KeyValuePair <Guid, IDictionary <XName, InstanceValue> > keyValuePair in this.keysToAssociate)
                     {
                         keyValuePair.Value.ValidatePropertyBag();
                     }
                 }
                 return;
             }
             else
             {
                 throw FxTrace.Exception.AsError(new InvalidOperationException(SRCore.LoadOpKeyMustBeValid));
             }
         }
         else
         {
             throw FxTrace.Exception.AsError(new InvalidOperationException(SRCore.AlreadyBoundToInstance));
         }
     }
     else
     {
         throw FxTrace.Exception.AsError(new InvalidOperationException(SRCore.OwnerRequired));
     }
 }
Beispiel #19
0
        /// <summary>
        /// 创建工作流
        /// </summary>
        /// <param name="parameters">传入的参数</param>
        /// <returns>获取工作流实例的Id值</returns>
        public string Create(IDictionary <string, object> parameters)
        {
            _instanceStore = new SqlWorkflowInstanceStore(connectionString);
            InstanceView view = _instanceStore.Execute
                                    (_instanceStore.CreateInstanceHandle(),
                                    new CreateWorkflowOwnerCommand(),
                                    TimeSpan.FromSeconds(30));

            _instanceStore.DefaultInstanceOwner = view.InstanceOwner;

            WorkflowApplication i = new WorkflowApplication(ActivityXamlServices.Load(path), parameters);

            i.InstanceStore   = _instanceStore;
            i.PersistableIdle = (waiea) => PersistableIdleAction.Unload;
            i.Run();
            return(i.Id.ToString());
        }
Beispiel #20
0
        public static InstanceStore SetupInstanceStore()
        {
            //***********Important Notice*************
            //You need to modify the following line of code before running the sample.
            //Replace the value of myConnectionString with the value of the "Connection String" property
            //of the WorkflowInstanceStore database on your own machine.
            string        myConnectionString = @"Data Source=localhost;Initial Catalog=PersistenceDB;Integrated Security=True";
            InstanceStore instanceStore      = new SqlWorkflowInstanceStore(myConnectionString);

            InstanceHandle handle = instanceStore.CreateInstanceHandle();
            InstanceView   view   = instanceStore.Execute(handle, new CreateWorkflowOwnerCommand(), TimeSpan.FromSeconds(30));

            handle.Free();

            instanceStore.DefaultInstanceOwner = view.InstanceOwner;

            return(instanceStore);
        }
Beispiel #21
0
            private bool TryLoadHelper(InstanceView view, out IDictionary <XName, InstanceValue> data)
            {
                if (!view.IsBoundToLock)
                {
                    data = null;
                    return(false);
                }
                this.instanceId = view.InstanceId;
                this.isLocked   = true;

                if (!this.handle.IsValid)
                {
                    throw FxTrace.Exception.AsError(new OperationCanceledException(SR.WorkflowInstanceAborted(this.InstanceId)));
                }

                data = view.InstanceData;
                return(true);
            }
Beispiel #22
0
 protected internal override void Validate(InstanceView view)
 {
     if (view.IsBoundToInstance)
     {
         if (view.IsBoundToInstanceOwner)
         {
             return;
         }
         else
         {
             throw FxTrace.Exception.AsError(new InvalidOperationException(SRCore.OwnerRequired));
         }
     }
     else
     {
         throw FxTrace.Exception.AsError(new InvalidOperationException(SRCore.InstanceRequired));
     }
 }
Beispiel #23
0
        public Guid NewWorkFlow(string workflowName, IDictionary <string, object> parameters)
        {
            var activity = Helpers.LoadWorkflowActiovityFromXaml(this._workflowRepositoryPath + workflowName, this._errorLogger);

            if (activity != null)
            {
                WorkflowApplication app = new WorkflowApplication(activity, parameters);
                app.Extensions.Add(() =>
                {
                    SQLTrackingPaticipant participant = new SQLTrackingPaticipant();
                    participant.ConnectionString      = _connectionString;
                    return(participant);
                });

                if (this._isPersistable)
                {
                    //setup persistence
                    InstanceStore store = new SqlWorkflowInstanceStore(
                        this._connectionString);
                    InstanceHandle handle = store.CreateInstanceHandle();
                    InstanceView   view   = store.Execute(handle,
                                                          new CreateWorkflowOwnerCommand(), TimeSpan.FromSeconds(30));
                    handle.Free();
                    store.DefaultInstanceOwner = view.InstanceOwner;
                    app.InstanceStore          = store;
                    app.PersistableIdle        = (e) => { return(PersistableIdleAction.Unload); };
                }
                try
                {
                    app.Run();
                    var wfinstance = new WorkflowInstance(workflowName, this, app);
                    wfinstance.State      = InstanceState.Created;
                    wfinstance.InstanceId = app.Id;
                    this._managedWorkflows.Add(wfinstance);
                    this._repository.SaveWorkflowInstanceState(app.Id, workflowName, InstanceState.Created, string.Empty);
                    return(app.Id);
                }
                catch (Exception ex)
                {
                    this._errorLogger.Log(ex.Message, LoggerInfoTypes.Error);
                }
            }
            return(Guid.Empty);
        }
Beispiel #24
0
        public InstanceView GetOneInstance(Instance instance)
        {
            InstanceView instanceView = new InstanceView();
            Instance     ins          = this.instanceRepositories.GetOneInstance(instance.Name, instance.Type);

            if (ins == null)
            {
                instanceView.StatusCode = FAILTURE;
            }
            else
            {
                instanceView.StatusCode = SUCCESS;
                List <Instance> instancedata = new List <Instance>();
                instancedata.Add(ins);
                instanceView.Data = instancedata;
            }

            return(instanceView);
        }
Beispiel #25
0
        private static void SetupInstanceStore()
        {
            try
            {
                instanceStore =
                    new SqlWorkflowInstanceStore(ConfigurationManager.ConnectionStrings["WFConnection"].ToString());
                instanceStore.InstanceCompletionAction = InstanceCompletionAction.DeleteNothing;

                InstanceHandle handle = instanceStore.CreateInstanceHandle();
                InstanceView   view   = instanceStore.Execute(handle, new CreateWorkflowOwnerCommand(), TimeSpan.FromSeconds(30));
                handle.Free();

                instanceStore.DefaultInstanceOwner = view.InstanceOwner;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #26
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            // Open the config file and get the connection string
            Configuration config =
                ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
            ConnectionStringsSection css =
                (ConnectionStringsSection)config.GetSection("connectionStrings");

            _connectionString = css.ConnectionStrings["LeadGenerator"].ConnectionString;

            _instanceStore = new SqlWorkflowInstanceStore(_connectionString);
            InstanceView view = _instanceStore.Execute
                                    (_instanceStore.CreateInstanceHandle(),
                                    new CreateWorkflowOwnerCommand(),
                                    TimeSpan.FromSeconds(30));

            _instanceStore.DefaultInstanceOwner = view.InstanceOwner;

            LoadExistingLeads();
        }
 protected internal override void Validate(InstanceView view)
 {
     if (view.IsBoundToInstance)
     {
         if (view.IsBoundToInstanceOwner)
         {
             if (this.keysToAssociate != null)
             {
                 foreach (KeyValuePair <Guid, IDictionary <XName, InstanceValue> > keyValuePair in this.keysToAssociate)
                 {
                     keyValuePair.Value.ValidatePropertyBag();
                 }
             }
             if (this.keyMetadataChanges != null)
             {
                 foreach (KeyValuePair <Guid, IDictionary <XName, InstanceValue> > keyMetadataChange in this.keyMetadataChanges)
                 {
                     keyMetadataChange.Value.ValidatePropertyBag(true);
                 }
             }
             if (!this.CompleteInstance || this.UnlockInstance)
             {
                 this.instanceMetadataChanges.ValidatePropertyBag(true);
                 this.instanceData.ValidatePropertyBag();
                 return;
             }
             else
             {
                 throw FxTrace.Exception.AsError(new InvalidOperationException(SRCore.ValidateUnlockInstance));
             }
         }
         else
         {
             throw FxTrace.Exception.AsError(new InvalidOperationException(SRCore.OwnerRequired));
         }
     }
     else
     {
         throw FxTrace.Exception.AsError(new InvalidOperationException(SRCore.InstanceRequired));
     }
 }
Beispiel #28
0
        public string Load(string id, string bookMark, params object[] ids)
        {
            _connectionString = System.Configuration.ConfigurationManager.AppSettings["ConnectionString"];
            _instanceStore    = new SqlWorkflowInstanceStore(_connectionString);
            InstanceView view = _instanceStore.Execute
                                    (_instanceStore.CreateInstanceHandle(),
                                    new CreateWorkflowOwnerCommand(),
                                    TimeSpan.FromSeconds(30));

            _instanceStore.DefaultInstanceOwner = view.InstanceOwner;
            WorkflowApplication i = new WorkflowApplication(ActivityXamlServices.Load(""));

            i.InstanceStore   = _instanceStore;
            i.PersistableIdle = (waiea) => PersistableIdleAction.Unload;
            i.Load(new Guid(id));

            var dd = i.ResumeBookmark(bookMark, ids);

            //var b = i.GetBookmarks();
            return("ok");
        }
Beispiel #29
0
        public void SetInstance(InstanceView x_instance)
        {
            try
            {
                errorProvider1.Dispose();
                ENTC_CodigoEntidad.Enabled = false;
                CbTipoEntidad.Enabled      = false;
                //CbBase.Enabled = false;
                //CbTipo.Enabled = false;
                //CbOrigen.Enabled = false;
                //CbDestino.Enabled = false;
                btnAgregar.Enabled = true;
                switch (x_instance)
                {
                case InstanceView.Default:
                    break;

                case InstanceView.New:

                    HashFormulario = FormValidateChanges.iniciarComparacionFormulario(this);
                    break;

                case InstanceView.Edit:
                    if (!String.IsNullOrEmpty(Presenter.ItemCab_Cotizacion.CONS_CodEstado))
                    {
                        btnAgregar.Enabled = Presenter.ItemCab_Cotizacion.CONS_CodEstado.Equals("001");
                    }
                    HashFormulario = FormValidateChanges.iniciarComparacionFormulario(this);
                    break;

                case InstanceView.Delete:
                    break;

                case InstanceView.Save:
                    break;
                }
            }
            catch (Exception ex)
            { Dialogos.MostrarMensajeError(Presenter.Title, Mensajes.SetInstanceView, ex); }
        }
Beispiel #30
0
        protected internal override void Validate(InstanceView view)
        {
            if (!view.IsBoundToInstanceOwner)
            {
                throw CoreWf.Internals.FxTrace.Exception.AsError(new InvalidOperationException(SR.OwnerRequired));
            }
            if (view.IsBoundToInstance)
            {
                throw CoreWf.Internals.FxTrace.Exception.AsError(new InvalidOperationException(SR.AlreadyBoundToInstance));
            }

            if (LookupInstanceKey == Guid.Empty)
            {
                throw CoreWf.Internals.FxTrace.Exception.AsError(new InvalidOperationException(SR.LoadOpKeyMustBeValid));
            }

            if (AssociateInstanceKeyToInstanceId == Guid.Empty)
            {
                if (InstanceKeysToAssociate.ContainsKey(LookupInstanceKey))
                {
                    throw CoreWf.Internals.FxTrace.Exception.AsError(new InvalidOperationException(SR.LoadOpAssociateKeysCannotContainLookupKey));
                }
            }
            else
            {
                if (!AcceptUninitializedInstance)
                {
                    throw CoreWf.Internals.FxTrace.Exception.AsError(new InvalidOperationException(SR.LoadOpFreeKeyRequiresAcceptUninitialized));
                }
            }

            if (_keysToAssociate != null)
            {
                foreach (KeyValuePair <Guid, IDictionary <XName, InstanceValue> > key in _keysToAssociate)
                {
                    InstancePersistence.ValidatePropertyBag(key.Value);
                }
            }
        }
Beispiel #31
0
 public static InstanceView CreateInstanceView(global::System.Collections.ObjectModel.ObservableCollection<VMRoleVIP> vIPs)
 {
     InstanceView instanceView = new InstanceView();
     if ((vIPs == null))
     {
         throw new global::System.ArgumentNullException("vIPs");
     }
     instanceView.VIPs = vIPs;
     return instanceView;
 }
Beispiel #32
0
 partial void OnInstanceViewChanging(InstanceView value);