Ejemplo n.º 1
0
        private static void InternalCopy(object caller, string format, object data, ClipboardAction action)
        {
            Initialize();

            lock (LockObject)
            {
                if (string.IsNullOrEmpty(format))
                {
                    throw new ArgumentNullException(nameof(format));
                }

                // Store data locally.
                _data       = data;
                _format     = format;
                _action     = action;
                _lastCaller = caller;

                var serializable = data as IRawSerializable;
                if (serializable != null)
                {
                    using (var ms = new MemoryStream())
                        Clipboard.SetData(format, ms.ToArray());
                }

                // Store a dummy in native clipboard.
                Clipboard.SetData(format, _dummy);
            }

            OnDataChanged(new ClipboardEventArgs(action));
        }
Ejemplo n.º 2
0
 internal void Reset()
 {
     _action = ClipboardAction.None;
     _dirty  = false;
     _open   = false;
     this.NotifyNodesChanged();
 }
 public void OnClipboardAction(ClipboardAction action)
 {
     foreach (var handler in registeredHandlers.Where((byAction) => byAction.ActionType == action))
     {
         if (handler.CanHandle())
             handler.ClipboardAction();
     }
 }
Ejemplo n.º 4
0
 public Hotkey(ClipboardAction action, Keys numberKey)
 {
     Action = action;
     Id     = HotkeyUtil.GetNextHotKeyId();
     if (Action == ClipboardAction.PASTE)
     {
         Modifier = Modifier | HotkeyUtil.ALT_MODIFIER_KEY;
     }
     Number = numberKey;
 }
Ejemplo n.º 5
0
        private static void Clear(bool clearSystemClipboard)
        {
            Initialize();

            lock (LockObject)
            {
                _data       = null;
                _format     = null;
                _lastCaller = null;
                _action     = ClipboardAction.Clear;

                if (clearSystemClipboard)
                {
                    // Clear native clipboard.
                    Clipboard.Clear();
                }
            }
            OnDataChanged(new ClipboardEventArgs(_action));
        }
        public AnimationElement PasteFromClipboard(AnimationSequencer destinationSequence)
        {
            AnimationElement pastedMember = null;

            switch (this.CurrentClipboardAction)
            {
            case ClipboardAction.Clone:
                pastedMember = cloneAndPaste(destinationSequence);
                break;

            case ClipboardAction.Cut:
                pastedMember = cutAndPaste(destinationSequence);
                break;
            }
            this.CurrentClipboardAction = ClipboardAction.None;
            this.currentClipboardObject = null;

            return(pastedMember);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// This function allow user to Copy/Cut selected chunks to the internal clipboard
        /// </summary>
        /// <param name="action"></param>
        private void ClipboardItems(ClipboardAction action)
        {
            SessionState.Clipboard.Action = action;
            SessionState.Clipboard.Items.Clear();
            SessionState.Clipboard.ItemId      = itemId;
            SessionState.Clipboard.InputFormId = Convert.ToInt32(inputFormId);
            SessionState.Clipboard.CultureCode = SessionState.Culture.Code;
            int nbCopyItems = 0;

            // Uncheck Header cell if necessary
            ((CheckBox)(col.HeaderItem.FindControl("g_ca"))).Checked = false;

            // Loop items and copy to clipboard
            int  currentIndex = -1;
            bool isInherited, hasFallback = false;

            for (int i = 0; i < col.CellItems.Count; i++)
            {
                currentIndex = ((CellItem)col.CellItems[i]).Cell.Row.Index;
                CheckBox cb = (CheckBox)((CellItem)col.CellItems[i]).FindControl("g_sd");
                if (cb != null && cb.Checked)
                {
                    //Modified by Prabhu for CR 5160 & ACQ 8.12 (PCF1: Auto TR Redesign)-- 21/Jun/09
                    isInherited = Convert.ToBoolean(dg.Rows[currentIndex].Cells.FromKey("Inherited").Value);
                    hasFallback = Convert.ToBoolean(dg.Rows[currentIndex].Cells.FromKey("hasFallback").Value);
                    if (!isInherited && !hasFallback)
                    {
                        SessionState.Clipboard.Items.Add(new ClipboardItem(Convert.ToInt64(itemId),
                                                                           Convert.ToInt32(dg.Rows[currentIndex].Cells.FromKey("ContainerId").Value),
                                                                           dg.Rows[currentIndex].Cells.FromKey("ContainerName").Value.ToString(), SessionState.Culture.Code));
                        nbCopyItems++;
                        cb.Checked = false;
                    }
                }
            }
            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "clipboard", "<script>alert('" + nbCopyItems.ToString() + " item(s) copied to clipboard');</script>");
        }
Ejemplo n.º 8
0
		private static void Clear(bool clearSystemClipboard)
		{
			Initialize();

			lock (LockObject)
			{
				_data = null;
				_format = null;
				_lastCaller = null;
				_action = ClipboardAction.Clear;

				if (clearSystemClipboard)
					// Clear native clipboard.
					Clipboard.Clear();
			}
			OnDataChanged(new ClipboardEventArgs(_action));
		}
 public void CutToClipboard(AnimationElement animationElement, AnimationSequencer sourceSequence)
 {
     this.CurrentClipboardAction = ClipboardAction.Cut;
     this.currentClipboardObject = new object[] { animationElement, sourceSequence };
 }
 public void CopyToClipboard(AnimationElement animationElement)
 {
     CurrentClipboardAction = ClipboardAction.Clone;
     currentClipboardObject = animationElement;
 }
 public void CopyToClipboard(AnimatedAbility ability)
 {
     CurrentClipboardAction = ClipboardAction.Clone;
     currentClipboardObject = ability;
 }
Ejemplo n.º 12
0
 public ClipboardEventArgs(ClipboardAction action)
 {
     Action = action;
 }
Ejemplo n.º 13
0
 public void RegisterHandler(ClipboardAction action, Action onClipboardAction, Func<bool> canHandle)
 {
     registeredHandlers.Add(new Handler() { ActionType = action, ClipboardAction = onClipboardAction, CanHandle = canHandle });
 }
Ejemplo n.º 14
0
 public Hotkey(ClipboardAction action, int numberKeyId) : this(action, (Keys)numberKeyId)
 {
 }
Ejemplo n.º 15
0
 public Clipboard(int inputFormId, ClipboardAction action)
 {
     _Action = action;
 }
Ejemplo n.º 16
0
 public ClipboardTool(ToolArgs args, ClipboardAction action)
     : base(args)
 {
     this.action = action;
       args.pictureBox.MouseClick += new MouseEventHandler(OnMouseClick);
 }
Ejemplo n.º 17
0
		public ClipboardEventArgs(ClipboardAction action)
		{
			Action = action;
		}
Ejemplo n.º 18
0
		private static void InternalCopy(object caller, string format, object data, ClipboardAction action)
		{
			Initialize();

			lock (LockObject)
			{
				if (string.IsNullOrEmpty(format))
					throw new ArgumentNullException(nameof(format));

				// Store data locally.
				_data = data;
				_format = format;
				_action = action;
				_lastCaller = caller;

				var serializable = data as IRawSerializable;
				if (serializable != null)
				{
					using (var ms = new MemoryStream())
						Clipboard.SetData(format, ms.ToArray());
				}

				// Store a dummy in native clipboard.
				Clipboard.SetData(format, _dummy);
			}

			OnDataChanged(new ClipboardEventArgs(action));
		}
Ejemplo n.º 19
0
 public ClipboardTask(Keys slotKey, ClipboardAction action)
 {
     SlotKey = slotKey;
     Action  = action;
 }
Ejemplo n.º 20
0
 internal void Reset()
 {
     _action = ClipboardAction.None;
     _dirty = false;
     _open = false;
     this.NotifyNodesChanged();
 }
Ejemplo n.º 21
0
 public Clipboard(ClipboardAction action)
 {
     _Action = action;
 }
Ejemplo n.º 22
0
 public ClipboardTool(ToolArgs args, ClipboardAction action)
     : base(args)
 {
     this.action = action;
     args.pictureBox.MouseClick += new MouseEventHandler(OnMouseClick);
 }