Exemple #1
0
        public void Should_serialize_and_deserialize_no_update_condition()
        {
            var step = new WorkflowStep(noUpdate: NoUpdate.When("Expression", "Role1", "Role2"));

            var serialized = step.SerializeAndDeserialize();

            serialized.Should().BeEquivalentTo(step);
        }
Exemple #2
0
        public void Should_serialize_and_deserialize_no_update_condition()
        {
            var step = new WorkflowStep(noUpdate: NoUpdate.When("Expression", "Role1", "Role2"));

            var serialized = step.SerializeAndDeserialize();

            Assert.Equal(step, serialized);
        }
Exemple #3
0
        public void Should_serialize_and_deserialize()
        {
            var workflow = new Workflow(
                Status.Draft, new Dictionary <Status, WorkflowStep>
            {
                [Status.Draft] = new WorkflowStep(
                    new Dictionary <Status, WorkflowTransition>
                {
                    [Status.Published] = WorkflowTransition.When("Expression", "Role1", "Role2")
                },
                    "#00ff00",
                    NoUpdate.When("Expression", "Role1", "Role2"))
            }, new List <DomainId> {
                DomainId.NewGuid()
            }, "MyName");

            var serialized = workflow.SerializeAndDeserialize();

            serialized.Should().BeEquivalentTo(workflow);
        }
Exemple #4
0
        public void Should_serialize_and_deserialize()
        {
            var workflow = new Workflow(
                Status.Draft,
                new Dictionary <Status, WorkflowStep>
            {
                [Status.Draft] = new WorkflowStep(
                    new Dictionary <Status, WorkflowTransition>
                {
                    [Status.Published] = WorkflowTransition.When("Expression", "Role1", "Role2")
                }.ToReadonlyDictionary(),
                    "#00ff00",
                    NoUpdate.When("Expression", "Role1", "Role2"))
            }.ToReadonlyDictionary(),
                ReadonlyList.Create(DomainId.NewGuid()), "MyName");

            var serialized = workflow.SerializeAndDeserialize();

            Assert.Equal(workflow, serialized);
        }
Exemple #5
0
 /// <summary>
 /// 检查更新
 /// </summary>
 public void Check()
 {
     Message = "正在检查服务器程序版本...";
     System.Threading.Tasks.Task.Factory.StartNew(() =>
     {
         var versionFileInfo = VersionFileInfo.Check();
         if (versionFileInfo != null)
         {
             Message = "发现新版本,是否更新?";
             this.Dispatcher.Invoke(new Action(() =>
             {
                 wpControl.Visibility = Visibility.Visible;
             }));
         }
         else
         {
             Message = "您的程序已经是最新版本!";
             NoUpdate?.Invoke();
         }
     });
 }