示例#1
0
 protected override void OnDragDrop(DragDropArgs e)
 {
     using (CompositeTask.Run("ChangeParent"))
     {
         ModelDragData dragData = e.Context.GetDragData() as ModelDragData;
         if (dragData != null && dragData.MetaData != null)
         {
             if (typeof(WidgetObject).IsAssignableFrom(dragData.MetaData.Type))
             {
                 List <VisualObject>     visualObjectList = new List <VisualObject>();
                 NodeObject              nodeObject       = dragData.MetaData.CreateObject();
                 CocoStudio.Model.PointF scene            = SceneTransformHelp.ConvertControlToScene(new CocoStudio.Model.PointF((float)e.X, (float)e.Y));
                 nodeObject.Position = this.TransformToSelf(scene);
                 this.Children.Add(nodeObject);
                 visualObjectList.Add((VisualObject)nodeObject);
                 EventAggregator.Instance.GetEvent <SelectedVisualObjectsChangeEvent>().Publish(new SelectedVisualObjectsChangeEventArgs((IEnumerable <VisualObject>)visualObjectList, (IEnumerable <VisualObject>)visualObjectList, false));
             }
             else
             {
                 LogConfig.Output.Info((object)LanguageInfo.ListViewOutputMessage);
             }
         }
         this.SetObjectState(CSNode.ObjectState.Default);
     }
 }
示例#2
0
文件: Hunger.cs 项目: Flave229/Puffin
        public ITask GenerateTask()
        {
            Queue <ITask> queuedTasks   = new Queue <ITask>();
            ITask         compositeTask = new CompositeTask(queuedTasks);

            ITask findFood = new FindTask <Food>(_owningAgent, (target, food) =>
            {
                // Called when food found. Create seek task.
                ITask seekFood = new SeekTask(_owningAgent, target, 3, () =>
                {
                    ITask intentTask = new IntentTask(_owningAgent, food, EIntent.EAT, () =>
                    {
                        EnergyCompontent foodEnergy = food.TakeEnergy(new EnergyCompontent
                        {
                            EnergyType = EEnergyType.NOURISHMENT
                        });
                        _owningAgent.GiveEnergy(new EnergyCompontent
                        {
                            EnergyType = EEnergyType.NOURISHMENT,
                            KiloJoules = foodEnergy.KiloJoules
                        });
                    });
                    queuedTasks.Enqueue(intentTask);
                });
                queuedTasks.Enqueue(seekFood);
            });

            queuedTasks.Enqueue(findFood);
            compositeTask.Start();

            return(compositeTask);
        }
示例#3
0
 private void SetValue(ResourceFile item)
 {
     if (item != null)
     {
         if (this._propertyItem != null)
         {
             this.resourceFile = item;
             string arg;
             if (this._propertyItem.ResourceFilterDescriptor == null)
             {
                 arg = ".png,jpg";
             }
             else
             {
                 arg = string.Join(",", this._propertyItem.ResourceFilterDescriptor.FileFilter);
             }
             this.imageWidget.TooltipText = string.Format("{0}{1}\r\n{2}", LanguageInfo.Display_SupportFileTypes, arg, item.FullPath);
             Xwt.Drawing.Image image = (item.PreviewImageInfo == null) ? null : item.PreviewImageInfo.Image;
             if (image != null)
             {
                 this.ScaleImage(image);
             }
             using (CompositeTask.Run(this._propertyItem.DiaplayName))
             {
                 this._propertyItem.SetValue(this._propertyDescriptor.Name, item, null);
             }
         }
     }
 }
 private void color_ColorChanged(object sender, ColorExEvent e)
 {
     this.color.ColorChanged -= new EventHandler <ColorExEvent>(this.color_ColorChanged);
     using (CompositeTask.Run("ColorChanged"))
         this._propertyItem.SetValue(this.colorText, (object)e.Color, (object[])null);
     this.color.ColorChanged += new EventHandler <ColorExEvent>(this.color_ColorChanged);
 }
示例#5
0
 private void SetValue(ResourceFile file)
 {
     if (file != null && file.IsValid)
     {
         if (file != null)
         {
             string text = this.CheckNest(file);
             if (!string.IsNullOrEmpty(text))
             {
                 LogConfig.Output.Error(text, null);
                 return;
             }
             using (CompositeTask.Run(this._propertyItem.DiaplayName))
             {
                 this._propertyItem.SetValue(this._propertyItem.Instance, file, null);
             }
             IPlayControl playControl = this._propertyItem.Instance as IPlayControl;
             if (playControl != null)
             {
                 playControl.Start();
             }
         }
         this.ScenceSetValue();
     }
 }
示例#6
0
		public void RemoveTask(CompositeTask task)
		{
			lock(mutex)
			{
				this.tasks.Remove(task);
				this.Wakeup();
			}
		}
示例#7
0
		public void AddTask(CompositeTask task)
		{
			lock(mutex)
			{
				this.tasks.AddLast(task);
				this.Wakeup();
			}
		}
 public void AddTask(CompositeTask task)
 {
     lock (mutex)
     {
         this.tasks.AddLast(task);
         this.Wakeup();
     }
 }
 public void RemoveTask(CompositeTask task)
 {
     lock (mutex)
     {
         this.tasks.Remove(task);
         this.Wakeup();
     }
 }
示例#10
0
 public void SetValue(string propertyDataName, object value, object[] index)
 {
     if (this.InstanceList == null)
     {
         return;
     }
     using (CompositeTask.Run("SetValue"))
     {
         for (int index1 = this.InstanceList.Count - 1; index1 >= 0; --index1)
         {
             this.InstanceList[index1].GetType().GetProperty(propertyDataName).SetValue(this.InstanceList[index1], value, index);
         }
     }
 }
示例#11
0
            public override void SetValue(ref object instance, Arguments index, bool value, object aspectArgs)
            {
                SliderObject sliderObject = (SliderObject)instance;

                sliderObject._scale9Enabled = value;
                sliderObject.GetInnerWidget().SetScale9Enabled(value);
                string compositeTaskName = sliderObject.GetType().Name + "Scale9Enable";

                using (CompositeTask.Run(compositeTaskName))
                {
                    sliderObject.RefreshBoundingBox(false);
                    sliderObject.RaisePropertyChanged <PointF>(() => sliderObject.Size);
                    sliderObject.RaisePropertyChanged <bool>(() => sliderObject.Scale9Enable);
                }
            }
示例#12
0
 protected virtual void UpDateData(System.Action action = null)
 {
     this.editorWidget_BeforeValueChanged();
     if (action != null && this._propertyItem != null)
     {
         if (TaskServiceSingleton.Instance.IsRunningCompositeTask)
         {
             action();
         }
         else
         {
             using (CompositeTask.Run("Property Row"))
                 action();
         }
     }
     this.editorWidget_AfterValueChanged();
 }
示例#13
0
 public void SetValue(object obj, object value, object[] index)
 {
     if (this.InstanceList != null)
     {
         using (CompositeTask.Run("SetValue"))
         {
             for (int index1 = this.InstanceList.Count - 1; index1 >= 0; --index1)
             {
                 this.propertyData.SetValue(this.InstanceList[index1], value, index);
             }
         }
     }
     else
     {
         this.propertyData.SetValue(this.Instance, value, index);
     }
 }
示例#14
0
        private void SetValue(ResourceFile item)
        {
            if (item == null || this._propertyItem == null)
            {
                return;
            }
            this.resourceFile = item;
            string str = this._propertyItem.ResourceFilterDescriptor != null?string.Join(",", this._propertyItem.ResourceFilterDescriptor.FileFilter) : ".png,jpg";

            this.imageWidget.TooltipText = string.Format("{0}{1}\r\n{2}", (object)LanguageInfo.Display_SupportFileTypes, (object)str, (object)item.FullPath);
            Xwt.Drawing.Image image = item.PreviewImageInfo == null ? (Xwt.Drawing.Image)null : item.PreviewImageInfo.Image;
            if (image != null)
            {
                this.ScaleImage(image);
            }
            using (CompositeTask.Run(this._propertyItem.DiaplayName))
                this._propertyItem.SetValue(this._propertyDescriptor.Name, (object)item, (object[])null);
        }
示例#15
0
            public override void SetValue(ref object instance, Arguments index, bool value, object aspectArgs)
            {
                ImageViewObject imageViewObject = (ImageViewObject)instance;

                imageViewObject._scale9Enabled = value;
                imageViewObject.GetInnerWidget().SetScale9Enabled(value);
                string compositeTaskName = imageViewObject.GetType().Name + "Scale9Enable";

                using (CompositeTask.Run(compositeTaskName))
                {
                    if (!value)
                    {
                        imageViewObject.PreSizeEnable = false;
                    }
                    imageViewObject.RefreshBoundingBox(false);
                    imageViewObject.RaisePropertyChanged <PointF>(() => imageViewObject.Size);
                    imageViewObject.RaisePropertyChanged <bool>(() => imageViewObject.Scale9Enable);
                }
            }
 private void linkLabel_LeftClicked(object sender, LabelClickedEventArgs e)
 {
     foreach (PropertyDescriptor propertyDescriptor in PropertyGridUtilities.GetPropertyDescriptors(this._propertyItem.Instance))
     {
         if (propertyDescriptor.Name == this._displayName)
         {
             using (CompositeTask.Run(this._propertyItem.DiaplayName))
                 propertyDescriptor.ResetValue(this._propertyItem.Instance);
             this.ScenceSetValue();
             IPlayControl instance = this._propertyItem.Instance as IPlayControl;
             if (instance == null)
             {
                 break;
             }
             instance.Start();
             break;
         }
     }
 }
示例#17
0
            public override void SetValue(ref object instance, Arguments index, bool value, object aspectArgs)
            {
                ButtonObject buttonObject = (ButtonObject)instance;

                buttonObject._scale9Enabled = value;
                buttonObject.GetInnerWidget().SetScale9Enabled(value);
                string compositeTaskName = buttonObject.GetType().Name + "Scale9Enable";

                using (CompositeTask.Run(compositeTaskName))
                {
                    if (!value)
                    {
                        buttonObject.PreSizeEnable = false;
                    }
                    buttonObject.RefreshBoundingBox(false);
                    buttonObject.RaisePropertyChanged <CocoStudio.Model.PointF>(() => buttonObject.Size);
                    buttonObject.RaisePropertyChanged <bool>(() => buttonObject.Scale9Enable);
                }
            }
示例#18
0
        private void linkLabel_LeftClicked(object sender, LabelClickedEventArgs e)
        {
            PropertyDescriptorCollection propertyDescriptors = PropertyGridUtilities.GetPropertyDescriptors(this._propertyItem.Instance);

            foreach (PropertyDescriptor propertyDescriptor in propertyDescriptors)
            {
                if (propertyDescriptor.Name == this._displayName)
                {
                    using (CompositeTask.Run(this._propertyItem.DiaplayName))
                    {
                        propertyDescriptor.ResetValue(this._propertyItem.Instance);
                    }
                    this.ScenceSetValue();
                    IPlayControl playControl = this._propertyItem.Instance as IPlayControl;
                    if (playControl != null)
                    {
                        playControl.Start();
                    }
                    break;
                }
            }
        }
示例#19
0
 protected override void OnDragDrop(DragDropArgs e)
 {
     using (CompositeTask.Run("ChangeParent"))
     {
         ModelDragData dragData = e.Context.GetDragData() as ModelDragData;
         if (dragData != null && dragData.MetaData != null)
         {
             if (dragData.MetaData.Type == typeof(PanelObject))
             {
                 NodeObject nodeObject         = dragData.MetaData.CreateObject();
                 CocoStudio.Model.PointF scene = SceneTransformHelp.ConvertControlToScene(new CocoStudio.Model.PointF((float)e.X, (float)e.Y));
                 nodeObject.Position = this.TransformToSelf(scene);
                 this.Children.Add(nodeObject);
             }
             else
             {
                 LogConfig.Output.Error((object)LanguageInfo.OutputMessage);
             }
         }
         this.SetObjectState(CSNode.ObjectState.Default);
     }
 }
        // Token: 0x06000039 RID: 57 RVA: 0x00002E68 File Offset: 0x00001068
        protected RetrievedPayload RetrieveTaskDistributionPayload(OrganizationId organizationId, Guid jobRunId, int taskId)
        {
            RetrievedPayload      retrievedPayload      = new RetrievedPayload();
            ComplianceJobProvider complianceJobProvider = new ComplianceJobProvider(organizationId);
            Guid          tenantGuid    = organizationId.GetTenantGuid();
            CompositeTask compositeTask = complianceJobProvider.FindCompositeTasks(tenantGuid, jobRunId, null, new int?(taskId)).SingleOrDefault <CompositeTask>();

            if (compositeTask != null)
            {
                foreach (string identifier in compositeTask.Users)
                {
                    JobPayload jobPayload = new JobPayload();
                    jobPayload.Target = new Target
                    {
                        TargetType = Target.Type.MailboxSmtpAddress,
                        Identifier = identifier
                    };
                    retrievedPayload.Children.Add(jobPayload);
                }
                return(retrievedPayload);
            }
            throw new ArgumentException(string.Format("No Task data found. TenantId-{0} JobId-{1} and TaskId-{2}", tenantGuid, jobRunId, taskId));
        }
示例#21
0
 private void SaveAll()
 {
     using (CompositeTask.Run("编辑文本"))
     {
         PropertyInfo property = this.TriggerObject.GetType().GetProperty(this.textProperty);
         if (this.canLineFeed)
         {
             property.SetValue(this.TriggerObject, (object)this.textview.Buffer.Text, (object[])null);
         }
         else
         {
             property.SetValue(this.TriggerObject, (object)this.textEntry.Text, (object[])null);
         }
         if (this.fontSizeType != null)
         {
             this.TriggerObject.GetType().GetProperty(this.fontSizeType).SetValue(this.TriggerObject, (object)Convert.ToInt32(this.combox.Entry.Text), (object[])null);
         }
         if (this.colorType == null)
         {
             return;
         }
         this.TriggerObject.GetType().GetProperty(this.colorType).SetValue(this.TriggerObject, (object)(System.Drawing.Color) this.colorButtonGtk.color.Value, (object[])null);
     }
 }
 private void SetValue(ResourceFile file)
 {
     if (file == null || !file.IsValid)
     {
         return;
     }
     if (file != null)
     {
         string str = this.CheckNest(file);
         if (!string.IsNullOrEmpty(str))
         {
             LogConfig.Output.Error((object)str, (Exception)null);
             return;
         }
         using (CompositeTask.Run(this._propertyItem.DiaplayName))
             this._propertyItem.SetValue(this._propertyItem.Instance, (object)file, (object[])null);
         IPlayControl instance = this._propertyItem.Instance as IPlayControl;
         if (instance != null)
         {
             instance.Start();
         }
     }
     this.ScenceSetValue();
 }
示例#23
0
 public static DslModeling::LinkedElementCollection <Task> GetTasks(CompositeTask element)
 {
     return(GetRoleCollection <DslModeling::LinkedElementCollection <Task>, Task>(element, CompositeTaskDomainRoleId));
 }
示例#24
0
 public static void SetParent(Task element, CompositeTask newCompositeTask)
 {
     DslModeling::DomainRoleInfo.SetLinkedElement(element, TaskDomainRoleId, newCompositeTask);
 }
示例#25
0
 /// <summary>
 /// Constructor
 /// Creates a Children link in the same Partition as the given CompositeTask
 /// </summary>
 /// <param name="source">CompositeTask to use as the source of the relationship.</param>
 /// <param name="target">Task to use as the target of the relationship.</param>
 public Children(CompositeTask source, Task target)
     : base((source != null ? source.Partition : null), new DslModeling::RoleAssignment[] { new DslModeling::RoleAssignment(Children.CompositeTaskDomainRoleId, source), new DslModeling::RoleAssignment(Children.TaskDomainRoleId, target) }, null)
 {
 }
示例#26
0
 private ModelElement GetParentForCompositeTask(CompositeTask task)
 {
     return task.Parent;
 }