Exemplo n.º 1
0
 private void whiteboardWindowToolStripMenuItem_Click(object sender, EventArgs e)
 {
     try
     {
         if (_Controller != null)
         {
             WhiteboardDialog c = new WhiteboardDialog(this, _Controller, null);
             List<string> dm_list = DDD_Global.Instance.DM_List;
             dm_list.Remove(DDD_Global.Instance.PlayerID);
             c.Members = dm_list;
             if (c.ShowProperties() == DialogResult.OK)
             {
                 List<string> selected = c.SelectedMembers;
                 if (selected != null)
                 {
                     if (selected.Count > 0)
                     {
                         selected.Add(DDD_Global.Instance.PlayerID);
                         _Controller.RequestWhiteboardRoomCreate(c.GroupId, selected, DDD_Global.Instance.PlayerID);
                     }
                     else
                     {
                         MessageBox.Show("At least one DM is necessary to create a whiteboard room.", "Whiteboard Room Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                     }
                 }
             }
             c.Dispose();
         }
     }
     catch (Exception exc)
     {
         throw new Exception(exc.Message);
     }
 }
Exemplo n.º 2
0
        public void CreateWhiteboardRoom(string tab_name, string room_name, List<string> membership_list, string senderDM)
        {
            try
            {
                if (!IsDisposed)
                {
                    if (!InvokeRequired)
                    {
                        try
                        {
                            if (_Controller != null && !(TabControls.TabPages.ContainsKey(room_name)))
                            {
                                // Create new whiteboard room
                                WhiteboardRoom wbRoom = new WhiteboardRoom(room_name, membership_list, _Controller);

                                // Create new whiteboard tab
                                WhiteboardDialog c = new WhiteboardDialog(this, _Controller, wbRoom);
                                c.GroupId = tab_name;
                                c.Channel = room_name;
                                c.Members = membership_list;
                                c.AllowPropertyChanges = false;
                                c.EnableRoomOwnerControls(senderDM == DDD_Global.Instance.PlayerID);
                                TabControls.TabPages.Add(room_name, tab_name);
                                TabControls.TabPages[room_name].Controls.Add(c);

                                // Add this whiteboard to the other whiteboard rooms listbox
                                foreach (TabPage tabPage in TabControls.TabPages)
                                {
                                    if (tabPage.Controls[0] is WhiteboardDialog)
                                    {
                                        if (((WhiteboardDialog)tabPage.Controls[0]).WBRoom != null)
                                        {
                                            WhiteboardRoom otherWBRoom = ((WhiteboardDialog)tabPage.Controls[0]).WBRoom;

                                            if (string.Compare(otherWBRoom.Name, room_name) != 0)
                                            {
                                                // Add new room to listbox
                                                ((WhiteboardDialog)tabPage.Controls[0]).AddOtherRoom(room_name, wbRoom);

                                                // Add existing room to new room's listbox
                                                c.AddOtherRoom(otherWBRoom.Name, otherWBRoom);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                        catch (Exception e)
                        {
                            MessageBox.Show(e.Message, "Unable to create whiteboard room.", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }

                    }
                    else
                    {
                        BeginInvoke(new CreateWhiteboardRoomDelegate(CreateWhiteboardRoom), tab_name, room_name, membership_list, senderDM);
                    }
                }
            }
            catch (Exception exc)
            {
                throw new Exception(exc.Message);
            }
        }