Exemplo n.º 1
0
        public void CommandPasteItems()
        {
            if (!CanPasteItems())
            {
                return;
            }
            var clipboard = App.Resolve <IClipboardService>();
            var obj       = clipboard.GetDataObject();

            if (obj == null)
            {
                return;
            }
            var items       = (PanelItemBaseHolder)obj.GetData(typeof(PanelItemBaseHolder));
            var destObjects = m_Model.GetItem(m_Model.SelectedIndex);

            destObjects.DataType = items.DataType;
            //destObjects.CurrentPath.Push(PanelItemRoot.ROOT_OF_USERITEMS);
            foreach (var panelItem in items)
            {
                if (panelItem.GetType().Name.Equals(destObjects.DataType))
                {
                    if (destObjects.Contains(panelItem))
                    {
                        continue;
                    }
                    // add item to new panel
                    var newItem = (PanelItemBase)panelItem.Clone();
                    //newItem.Parent = PanelItemRootBase.ROOT_OF_USERITEMS;
                    destObjects.Items.Add(newItem);
                }
            }
            destObjects.AsyncRetrieveData(true);
            //m_View.ActivePanelView.Presenter.UpdateItemsAndStatus();
        }
Exemplo n.º 2
0
 public void SetLoadedModel(IPagesModel model)
 {
     if (model != null && model.Count > 0)
     {
         // add loaded tabs if present
         for (int index = 0; index < model.Count; index++)
         {
             var panelModel = model.GetItem(index);
             AddTab(panelModel);
         }
         if (model.SelectedIndex != -1)
         {
             SelectedIndex = model.SelectedIndex;
         }
     }
     if (Count == 0)
     {
         var root = m_FactoryManager.CreateDefaultRoot(DEFAULT1_PANELITEMTYPE);
         if (root == null)
         {
             root = m_FactoryManager.CreateDefaultRoot(DEFAULT2_PANELITEMTYPE);
         }
         if (root == null)
         {
             return;
         }
         // create default tab
         var info = App.Resolve <IPanelModel>();
         info.SetDefaultRoot(root);
         info.DataType = App.PanelFillers.GetFillType(root).Name;
         AddTab(info);
     }
 }