Example #1
0
        private void gridControl_DragDrop(object sender, DragEventArgs e)
        {
            TreeListMultiSelection selectionItem = e.Data.GetData(typeof(TreeListMultiSelection)) as TreeListMultiSelection;

            bool changed = false;

            foreach (Library.LibraryNode item in selectionItem)
            {
                MemoryLibraryItem tmpItem = item.Tag as MemoryLibraryItem;
                LiveMessageItem   libItem = new LiveMessageItem();
                libItem.Name   = tmpItem.Name;
                libItem.Target = tmpItem;
                libItem.Id     = tmpItem.Id;
                if (CategoryControl.CheckSameMemoryLibraryItem(libItem, DataSource))
                {
                    DataSource.Add(libItem);
                    RefreshDataSource();
                    changed = true;
                }
            }

            if (changed)
            {
                CategoryItemChanged();
            }
        }
Example #2
0
        private LiveMessageItem CreateLiveMsgItem(MemoryLibraryItem item)
        {
            LiveMessageItem msgItem = new LiveMessageItem();

            msgItem.Name   = item.Name;
            msgItem.Id     = item.Id;
            msgItem.Target = item;
            return(msgItem);
        }
Example #3
0
 public static bool CheckSameMemoryLibraryItem(LiveMessageItem item, List <LiveMessageItem> itemList)
 {
     foreach (LiveMessageItem tmpItem in itemList)
     {
         if (item.Target == tmpItem.Target)
         {
             return(false);
         }
     }
     return(true);
 }
Example #4
0
        private void AddItems()
        {
            if (ctlLibrary.SelectedItems != null &&
                ctlLibrary.SelectedItems.Count > 0)
            {
                foreach (Library.LibraryNode item in ctlLibrary.SelectedItems)
                {
                    if (ctlCategories.CurrentTabPageDataSource != null)
                    {
                        MemoryLibraryItem tmpItem = item.Tag as MemoryLibraryItem;

                        LiveMessageItem libItem = new LiveMessageItem();
                        libItem.Name   = tmpItem.Name;
                        libItem.Target = tmpItem;
                        libItem.Id     = tmpItem.Id;

                        if (CheckSameMemoryLibraryItem(libItem, ctlCategories.CurrentTabPageDataSource))
                        {
                            ctlCategories.CurrentTabPageDataSource.Add(libItem);
                            ctlCategories.CurrentMsgControl.RefreshDataSource();
                        }
                        else
                        {
                            MessageBox.Show(SameLibItem, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }
                    }
                    else
                    {
                        MessageBox.Show(NOCategory, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }

                if (ctlCategories.CurrentMsgControl != null &&
                    ctlCategories.CurrentMsgControl.DataSource != null)
                {
                    ctlCategories.CurrentMsgControl.RefreshDataSource();
                    ctlCategories.CurrentMsgControl.CategoryItemChanged();
                }
            }
        }
Example #5
0
        private void lbcMessageQueue_DragDrop(object sender, DragEventArgs e)
        {
            LiveMessageItem liveMessageItem = GetDragObject(sender, e.Data);

            if (liveMessageItem == null)
            {
                return;
            }
            string messageName = liveMessageItem.Name;
            string messageId   = liveMessageItem.Id;
            string serverPath  = messagePath + messageId + "/" + messageId + ".xml";
            string dragString  = messageName + "       " + liveMessageItem.LengthText;

            if (cmbMessageQueue.Text.Trim() == "" && lbcMessageQueue.ItemCount <= 0)
            {
                cmbMessageQueue.Text = dragString;
                PlayActionPerform(serverPath, 1);
                return;
            }
            ListBoxControl lb = sender as ListBoxControl;

            int ind = lb.IndexFromPoint(lb.PointToClient(new System.Drawing.Point(e.X, e.Y)));

            if (ind == -1)
            {
                lb.Items.Add(dragString);
                lbcMessageQueue.SelectedIndex = lbcMessageQueue.ItemCount - 1;
                PlayActionPerform(serverPath, lbcMessageQueue.ItemCount + 1);
            }
            else
            {
                lb.Items.Insert(ind, dragString);
                this.lbcMessageQueue.SelectedIndex = ind;
                PlayActionPerform(serverPath, ind + 2);
            }
        }