コード例 #1
0
    protected override void OnActiveViewChanged(object sender, EventArgs e) {
      IContentView activeView = MainFormManager.MainForm.ActiveView as IContentView;

      if (activeView != null && activeView.Content != null && !activeView.Locked) {
        var content = activeView.Content as IItem;
        if (content != null) {
          Type contentType = content.GetType();
          ToolStripItem.Enabled = ItemTask.IsTypeSupported(contentType);
          return;
        }
      }
      ToolStripItem.Enabled = false;
    }
コード例 #2
0
        private void jobsTreeView_DragEnter(object sender, DragEventArgs e)
        {
            e.Effect = DragDropEffects.None;
            var obj = (IDeepCloneable)e.Data.GetData(Constants.DragDropDataFormat);

            Type objType = obj.GetType();

            if (ItemTask.IsTypeSupported(objType))
            {
                if (Content.Id != Guid.Empty)
                {
                    e.Effect = DragDropEffects.None;
                }
                else if ((e.KeyState & 32) == 32)
                {
                    e.Effect = DragDropEffects.Link;                        // ALT key
                }
                else if (e.AllowedEffect.HasFlag(DragDropEffects.Copy))
                {
                    e.Effect = DragDropEffects.Copy;
                }
            }
        }