示例#1
0
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();
            //
            ClearControl obj = (ClearControl)target;

            //
            if (GUILayout.Button("Activate"))
            {
                obj.Activate();
            }
            if (GUILayout.Button("ResetMonitor"))
            {
                obj.ResetMonitor();
            }
        }
示例#2
0
        public async void UpdateResourceList()
        {
            ResourceModel resModel = await GetResource();

            resourceList.SuspendLayout();
            if (resourceList.InvokeRequired)
            {
                if (Disposing || IsDisposed)
                {
                    return;
                }
                ClearControl @delegate = new ClearControl(resourceList.Controls.Clear);
                Invoke(@delegate);
            }
            else


            {
                resourceList.Controls.Clear();
            }


            int index = 1;

            foreach (ResourceData resData in resModel.ResourceList)
            {
                if (index <= resModel.ResourceList.Count && index <= PrePageCount)
                {
                    PicturePlane pictureBox = new PicturePlane();
                    pictureBox.Dock = DockStyle.Fill;
                    pictureBox.SetImage(resModel.ResourceList[index - 1].IconUrl);
                    pictureBox.Picture.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(PictureBoxCtrl_DoubleClick);
                    pictureBox.Tag         = resModel.ResourceList[index - 1];
                    pictureBox.Picture.Tag = resModel.ResourceList[index - 1];


                    if (App.ResourceType == ResourceType.Icon || App.ResourceType == ResourceType.Upload_icon)
                    {
                        pictureBox.SetMarkVisible(false);
                        pictureBox.SetMenuVisible(true);
                        pictureBox.Padding       = new Padding(5);
                        pictureBox.ApplyFunction = new PicturePlane.DelegateApply(ApplyIcon);
                    }
                    else if (App.ResourceType == ResourceType.Upload_template || App.ResourceType == ResourceType.Upload_legend)
                    {
                        pictureBox.SetMenuVisible(true);
                        pictureBox.SetMarkVisible(false);
                        pictureBox.ApplyFunction = new PicturePlane.DelegateApply(ApplyTemplate);
                    }
                    else
                    {
                        pictureBox.SetMenuVisible(true);
                        if (resData.MarkFlag == "1" || App.ItemType == ResourceType.Wdsc)
                        {
                            pictureBox.SetMarkStatus(true);
                        }

                        pictureBox.ApplyFunction = new PicturePlane.DelegateApply(ApplyTemplate);
                    }
                    pictureBox.MarkFunction   = new  PicturePlane.DelegateApply(store);
                    pictureBox.UnMarkFunction = new PicturePlane.DelegateApply(unMark);
                    if (resourceList.InvokeRequired)
                    {
                        if (Disposing || IsDisposed)
                        {
                            return;
                        }
                        AddControl @delegate = new AddControl(resourceList.Controls.Add);
                        Invoke(@delegate, pictureBox);
                    }
                    else
                    {
                        resourceList.Controls.Add(pictureBox);
                    }
                }
                index++;
            }
            resourceList.ResumeLayout();
        }