Exemplo n.º 1
0
 //左边的tabBtn容器size发生变化
 private void flowLayoutPanelTab_Resize(object sender, EventArgs e)
 {
     foreach (var item in flowLayoutPanelTab.Controls)
     {
         if (item is ButtonTab)
         {
             ButtonTab buttonTab = (ButtonTab)item;
             buttonTab.Size = new Size(this.splitContainer.SplitterDistance - 2, buttonTab.Height);
         }
     }
 }
Exemplo n.º 2
0
 //关闭一个对话窗体
 public void closeDialogueWindow(string windowId)
 {
     this.Activate();
     //销毁窗体
     foreach (var item in formListDictionary)
     {
         if (item.Key == windowId)
         {
             item.Value.Close();
             item.Value.Dispose();
             //  activeDialog = item.Value;//设置激活对话
             // Debug.Print("关闭这个对话" + windowId);
             formListDictionary.Remove(windowId);
             break;
         }
     }
     foreach (var item in this.flowLayoutPanelTab.Controls)
     {
         ButtonTab btn = (ButtonTab)item;
         if (btn.m_id == windowId)
         {
             btn.Dispose();
             //设置一个新的激活窗体
             if (flowLayoutPanelTab.Controls.Count > 0)
             {
                 string nextActiveId = ((ButtonTab)flowLayoutPanelTab.Controls[flowLayoutPanelTab.Controls.Count - 1]).m_id;
                 changeActiveWindow(nextActiveId);
             }
             else
             {
                 buttonClose_Click(null, null);
             }
             break;
         }
     }
 }
Exemplo n.º 3
0
 //设置激活窗体
 public void changeActiveWindow(string activeId)
 {
     this.Activate();
     //窗体切换
     foreach (var item in formListDictionary)
     {
         if (item.Key == activeId)
         {
             item.Value.Show();
             activeDialog = item.Value;
         }
         else
         {
             item.Value.Hide();
         }
     }
     //选项卡切换
     foreach (var item in flowLayoutPanelTab.Controls)
     {
         ButtonTab btnTab = (ButtonTab)item;
         if (btnTab.m_id == activeId)
         {
             btnTab.BackColor = btnTab.oriColor;
             //顶部信息切换
             //if (btnTab.m_face != null)
             //{
             //    this.pictureBoxFace.Image = btnTab.m_face;
             //}
             this.labelTitle.Text = btnTab.m_dialogTitle;
         }
         else
         {
             btnTab.BackColor = AppConst.panelColor;
         }
     }
 }
Exemplo n.º 4
0
        //dialogType 资源类型
        //dialogName 表示群的名字 或者好友名字
        //dialogId 表示群号 或者好友的id
        public void openDialog(int dialogType, int dialogId = -1, string dialogName = "", Image face = null)
        {
            if (NetWorkManager.Instance.IsConnected == false)
            {
                MessageBox.Show("没有网络,请联网后重试", "叮叮鸟提示:");
                return;
            }
            switch (dialogType)
            {
            //case 0://请求打开商城
            //    if (formListDictionary.ContainsKey("shop") == false)
            //    {
            //        FormDialog formShop = new FormDialog(dialogType, -1, "商城", face);
            //        setParent(formShop);
            //        formListDictionary.Add("shop", formShop);
            //        //创建选项卡
            //        ButtonTab btnTab = new ButtonTab(0, "shop", "商城", null);
            //        this.flowLayoutPanelTab.Controls.Add(btnTab);
            //    }
            //    changeActiveWindow("shop");
            //    break;
            case 1:    //请求打开一个群窗体
                       //确认我在群中
                DataMgr.Instance.getGroupByID(dialogId, delegate(GroupInfoModel mode) {
                    if (mode.Member.Contains(AppInfo.PERSONAL_INFO.Username) || mode.Master.Contains(AppInfo.PERSONAL_INFO.Username) || mode.Manager.Contains(AppInfo.PERSONAL_INFO.Username))
                    {
                        //创建群对话窗体
                        if (formListDictionary.ContainsKey("group" + dialogId) == false)
                        {
                            FormDialog formGroup = new FormDialog(dialogType, dialogId, dialogName, face);
                            setParent(formGroup);
                            formListDictionary.Add("group" + dialogId, formGroup);
                            //创建选项卡
                            ButtonTab btnTab1 = new ButtonTab(1, "group" + dialogId, dialogName, face);
                            this.flowLayoutPanelTab.Controls.Add(btnTab1);
                            btnTab1.Size = new Size(this.splitContainer.SplitterDistance - 2, btnTab1.Height);
                        }
                        changeActiveWindow("group" + dialogId);
                    }
                    else
                    {
                        //DialogResult dr = MessageBox.Show("已经不在这个群中","提示:");
                        //if (dr == DialogResult.OK)
                        //{
                        //    Debug.Print("怎么还不停止呢");
                        //    return;
                        //}
                        return;
                    }
                });
                break;

            //case 2://请求打开个人
            //    if (formListDictionary.ContainsKey("self") == false)
            //    {
            //        FormDialog formSelf = new FormDialog(dialogType, -1, "我的", face);
            //        setParent(formSelf);
            //        formListDictionary.Add("self", formSelf);
            //        //创建选项卡
            //        ButtonTab btnTab2 = new ButtonTab(2, "self", "我的", face);
            //        this.flowLayoutPanelTab.Controls.Add(btnTab2);
            //    }
            //    changeActiveWindow("self");
            //    break;
            case 3:    //请求打开朋友
                if (formListDictionary.ContainsKey("friend" + dialogId) == false)
                {
                    FormDialog formFriend = new FormDialog(dialogType, dialogId, dialogName, face);
                    setParent(formFriend);
                    formListDictionary.Add("friend" + dialogId, formFriend);
                    //创建选项卡
                    ButtonTab btnTab1 = new ButtonTab(3, "friend" + dialogId, dialogName, face);
                    this.flowLayoutPanelTab.Controls.Add(btnTab1);
                    btnTab1.Size = new Size(this.splitContainer.SplitterDistance - 2, btnTab1.Height);
                }
                changeActiveWindow("friend" + dialogId);
                //Todo缺少判断 是否还拥有这个好友        if (AppInfo.MyFriendList.Contains(dialogId.ToString()))
                break;

            default:
                Debug.Print("错误的窗口类型!");
                break;
            }
            this.Show();
            this.WindowState = FormWindowState.Normal;
        }