コード例 #1
0
ファイル: Form1.cs プロジェクト: khiemnv/chatApp
 private MyTree.MyTitle Prog2Title(MyProgram prog)
 {
     MyTree.MyTitle title = new MyTree.MyTitle();
     title.title = prog.zName;
     title.path  = string.Format("{0}/{1}", prog.zPath, prog.zName);
     title.ID    = prog.ID;
     return(title);
 }
コード例 #2
0
ファイル: Form1.cs プロジェクト: khiemnv/chatApp
        private void ProgramTV_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            string path = (e.Node.Tag) as string;

            MyTree.MyTitle title = m_progTreeMng.GetTitle(path);
            if (title != null)
            {
                progCmb.Text = title.title;
            }
        }
コード例 #3
0
ファイル: Form1.cs プロジェクト: khiemnv/chatApp
        private List <MyTree.MyTitle> BuildProgramTree()
        {
            var progs = m_programs;
            List <MyTree.MyTitle> titleLst = new List <MyTree.MyTitle>();

            foreach (MyProgram prog in m_programs)
            {
                MyTree.MyTitle title = Prog2Title(prog);
                titleLst.Add(title);
            }
            return(titleLst);
        }
コード例 #4
0
ファイル: Form1.cs プロジェクト: khiemnv/chatApp
        private void ProgMiCopy_Click(object sender, EventArgs e)
        {
            if (programTV.SelectedNode == null)
            {
                return;
            }
            string path = (programTV.SelectedNode.Tag) as string;

            MyTree.MyTitle title = m_progTreeMng.GetTitle(path);
            if (title != null)
            {
                Clipboard.SetText(title.title);
            }
        }
コード例 #5
0
ファイル: Form1.cs プロジェクト: khiemnv/chatApp
        public List <MyTree.MyTitle> BuildRegTree()
        {
            var groups = m_groups;
            var regs   = getRegister();

            List <MyTree.MyTitle> titleLst = new List <MyTree.MyTitle>();

            Dictionary <UInt64, MyUser> userDict = new Dictionary <ulong, MyUser>();

            foreach (MyUser user in m_users)
            {
                if (userDict.ContainsKey(user.ID))
                {
                }
                else
                {
                    userDict.Add(user.ID, user);
                }
            }

            foreach (MyReg reg in regs)
            {
                if (!userDict.ContainsKey(reg.userID))
                {
                    continue;
                }
                reg.user = userDict[reg.userID];
                MyGroup        grp   = groups.Find(x => x.nGroup == reg.user.nGroup);
                MyTree.MyTitle title = new MyTree.MyTitle();
                title.title   = reg.user.zUserFb;
                title.path    = string.Format("register/{0}/{1}", grp.zGroup, title.title);
                title.content = string.Format("{0} ({1})", reg.nStatus, reg.zNote);
                titleLst.Add(title);

                userDict.Remove(reg.userID);
            }

            foreach (MyUser user in userDict.Values)
            {
                MyGroup        grp   = groups.Find(x => x.nGroup == user.nGroup);
                MyTree.MyTitle title = new MyTree.MyTitle();
                title.title = user.zUserFb;
                title.path  = string.Format("un-register/{0}/{1}", grp.zGroup, title.title);
                titleLst.Add(title);
            }

            return(titleLst);
        }
コード例 #6
0
ファイル: Form1.cs プロジェクト: khiemnv/chatApp
        private void TreeView1_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            string path = (e.Node.Tag) as string;

            MyTree.MyTitle title = m_treeMng.GetTitle(path);
            if (title != null)
            {
                var zopt = title.content;
                var user = m_users.Find(x => x.zUserFb == title.title);
                userCmb.Text = title.title;
                optTxt.Text  = zopt;
            }
            else
            {
                PreviewReport(e.Node);
            }
        }
コード例 #7
0
ファイル: Form1.cs プロジェクト: khiemnv/chatApp
        private void AddBtn_Click(object sender, EventArgs e)
        {
            int    nOpt;
            string zOpt;
            var    txt = optTxt.Text;
            bool   v   = ParseOpt(txt, out zOpt, out nOpt);

            if (!v)
            {
                return;
            }

            var       zUserFb = userCmb.Text;
            MyUser    user    = m_users.Find(x => x.zUserFb == zUserFb);
            var       zProg   = progCmb.Text;
            MyProgram prog    = m_programs.Find(x => x.zName == zProg);
            MyReg     myReg   = new MyReg();

            myReg.userID    = user.ID;
            myReg.programID = prog.ID;
            myReg.nStatus   = nOpt;
            myReg.zNote     = zOpt;
            int ret = m_cp.AddUpdateReg(myReg);

            //add to ricktext
            richTextBox1.SelectedText = user.zUserFb + string.Format("({0}-{1})\n", nOpt, zOpt);
            richTextBox1.ScrollToCaret();

            MyTree.MyTitle title = new MyTree.MyTitle();
            MyGroup        grp   = m_groups.Find(x => x.nGroup == user.nGroup);

            title.title   = user.zUserFb;
            title.content = string.Format("{0} ({1})", nOpt, zOpt);
            title.path    = string.Format("register/{0}/{1}", grp.zGroup, user.zUserFb);
            var nRet = m_treeMng.Add(title);

            if (nRet == 1)
            {
                title.path = string.Format("un-register/{0}/{1}", grp.zGroup, user.zUserFb);
                m_treeMng.Remove(title);
            }
        }