Beispiel #1
0
        void DesignWindow(CWindow window)
        {
            LayoutWindowDesigner frm = new LayoutWindowDesigner();

            frm.Window = window;
            frm.Show();
        }
Beispiel #2
0
    void GetData()
    {
        int page     = Convert.ToInt32(Request.Params["page"]);
        int pageSize = Convert.ToInt32(Request.Params["pagesize"]);


        string             sData  = "";
        List <CBaseObject> lstObj = Global.GetCtx(Session["TopCompany"].ToString()).WindowMgr.GetList();

        int totalPage = lstObj.Count % pageSize == 0 ? lstObj.Count / pageSize : lstObj.Count / pageSize + 1; // 计算总页数

        int index = (page - 1) * pageSize;                                                                    // 开始记录数

        for (int i = index; i < pageSize + index && i < lstObj.Count; i++)
        {
            CWindow Window = (CWindow)lstObj[i];

            sData += string.Format("{{ \"id\": \"{0}\",\"Name\":\"{1}\"}},"
                                   , Window.Id, Window.Name);
        }
        sData = sData.TrimEnd(",".ToCharArray());
        sData = "[" + sData + "]";
        string sJson = string.Format("{{\"Rows\":{0},\"Total\":\"{1}\"}}"
                                     , sData, lstObj.Count);

        Response.Write(sJson);
    }
Beispiel #3
0
        public override void Initialize(CWindow window)
        {
            window.PermaVariables.AddNewVariable("TriedLetters", new List<char>());
            window.PermaVariables.AddNewVariable("Stage", 0);
            window.PermaVariables.AddNewVariable("InGame", false);
            window.PermaVariables.AddNewVariable("AcceptInput", false);

            base.Initialize(window);
        }
Beispiel #4
0
        private void picIcon_Click(object sender, EventArgs e)
        {
            CWindow window = (CWindow)Program.Ctx.WindowMgr.Find(NavigateBarButton.UI_Window_id);

            if (window != null)
            {
                LayoutWindow frm = new LayoutWindow();
                frm.Window = window;
                frm.Show();
            }
        }
Beispiel #5
0
        private void tbtDesign_Click(object sender, EventArgs e)
        {
            if (dataGridView.CurrentRow == null)
            {
                MessageBox.Show("请选择一项!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            CWindow obj = (CWindow)dataGridView.CurrentRow.Tag;

            DesignWindow(obj);
        }
Beispiel #6
0
        void LoadWindow()
        {
            cbWindow.Items.Clear();
            List <CBaseObject> lstObj = Program.Ctx.WindowMgr.GetList();

            foreach (CBaseObject obj in lstObj)
            {
                CWindow  Window = (CWindow)obj;
                DataItem item   = new DataItem(Window.Name, Window);
                cbWindow.Items.Add(item);
            }
        }
Beispiel #7
0
        public override void Reply(CChatMaster chatMaster, CWindow window, CMessage message)
        {
            if (!(bool)window.PermaVariables.GetVariable("AcceptInput")) {
                return;
            }
            if (string.IsNullOrWhiteSpace(message.Message)) {
                return;
            }
            string sSwitch = "";
            string[] sTokens;

            if (!message.Message.Contains(" ")) {
                sSwitch = message.Message;
            } else {
                sTokens = message.Message.Split(' ');
                sSwitch = sTokens[0];
            }

            switch (sSwitch.ToLower()) {
                case "start":
                    Start(chatMaster, window);
                    break;

                case "restart":
                    Restart(chatMaster, window);
                    break;

                case "stop":
                    Close(chatMaster, window);
                    break;

                default:
                    if (!(bool)window.PermaVariables.GetVariable("InGame")) {
                        chatMaster.SendMessageToWindow(window, "Hi, " + window.ChatName + ". I'm not available, but would you like a game of hangman?"
                            + " If so, type 'start' to play!");
                    } else {
                        if (message.Message.Length > 1) {
                            if (sSwitch == new string((char[])window.PermaVariables.GetVariable("CurrentWord"))) {
                                Win(chatMaster, window);
                            } else {
                                chatMaster.SendMessageToWindow(window, "I don't know what \"" + message.Message + "\" means. If you're trying to play the game, "
                                + "please remember you can only try one letter at a time!");
                            }
                        } else {
                            TryLetter(chatMaster, window, sSwitch.ToLower()[0]);
                        }
                    }
                    return;
            }

            base.Reply(chatMaster, window, message);
        }
Beispiel #8
0
        public string GetProgress(CChatMaster chatMaster, CWindow window)
        {
            char[] progress = (char[])window.PermaVariables.GetVariable("Progress");
            List<char> triedLetters = (List<char>)window.PermaVariables.GetVariable("TriedLetters");

            string strResult = "";
            for (int i = 0; i < progress.Length; i++) {
                strResult += progress[i] + " ";
            }

            return GetCurrentHangman(window) +
                "\n" +
                strResult.Trim() +
                "\n"
                + string.Join(",", triedLetters.ToArray()) + "\n";
        }
Beispiel #9
0
        private void tbtDel_Click(object sender, EventArgs e)
        {
            if (dataGridView.CurrentRow == null)
            {
                MessageBox.Show("请选择一项!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            if (MessageBox.Show("是否确认删除?", "确认", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK)
            {
                return;
            }
            CWindow obj = (CWindow)dataGridView.CurrentRow.Tag;

            if (!Program.Ctx.WindowMgr.Delete(obj, true))
            {
                MessageBox.Show("删除失败!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                return;
            }
            dataGridView.Rows.Remove(dataGridView.CurrentRow);
        }
Beispiel #10
0
        // main public m8
        public Akcja(Scene s, string st, Image img)
        {
            usedScene      = s;
            TILESET_PATH   = img;
            TILESET_STRING = st;

            SetupEdges();

            MAIN_TILEMAP = new Tilemap(st, 64 * 32, 32);
            SetupTiles();

            Instance = this;

            //TODO: edytować nazwy klas i ogarnąć kod \//\//\/\/\ w klasie Settings
            set = new Settings(this);

            //forcuje odswierzenie podgladu
            updatePreview = true;
            updatePos     = true;

            // dodaje okno wyboru fragmentów
            CWindow tilesChooser = new CWindow(Akcja.TILESET_PATH.Width + 6, Akcja.TILESET_PATH.Height + 6, 5, 10, Color.Gray, "Tiles");

            tilesChooser.AddGraphicsToWindow(3, 3, Akcja.TILESET_PATH); // funcja dodająca grafike
            tilesChooser.AddButtonsForTiles();                          // TODO: Połączyć tą i funkcje wyzej, tak jak jest to w CWindow-options.
            usedScene.Add(tilesChooser);

            // okienko z informacjami fragmentu/podgląd
            tilePreview = new CWindow(100, 140, Akcja.TILESET_PATH.Width + 6 + 6, 10, Color.Gray, "Info");
            usedScene.Add(tilePreview);

            // ...
            SetupPreviewInfo();

            // okno opcji, zapis/wczytaj/pomoc/quit/clear
            CWindow options = new CWindow(184, 54, 5, Akcja.TILESET_PATH.Height + 6 + 1 + 45, Color.Red, "Options");

            options.AddButtonsForOptions();
            options.AddTextToWindow(4, 40, new RichText("Made by Daawson", 10));//witam
            usedScene.Add(options);
        }
Beispiel #11
0
 private void picIcon_Click(object sender, EventArgs e)
 {
     if (m_System == null) //系统管理
     {
         if (m_frmAdmin == null || m_frmAdmin.IsDisposed)
         {
             m_frmAdmin = new AdminForm();
         }
         m_frmAdmin.Show();
     }
     else
     {
         CWindow window = (CWindow)Program.Ctx.WindowMgr.Find(m_System.StartWindow);
         if (window != null)
         {
             LayoutWindow frm = new LayoutWindow();
             frm.Window = window;
             frm.Show();
         }
     }
 }
Beispiel #12
0
        private void TryLetter(CChatMaster chatMaster, CWindow window, char sSwitch)
        {
            if (HasTriedLetter(window, sSwitch)) {
                chatMaster.SendMessageToWindow(window, "You've already tried " + sSwitch.ToString() + "!");
                return;
            }

            char[] currentword = (char[])window.PermaVariables.GetVariable("CurrentWord");
            char[] progress = (char[])window.PermaVariables.GetVariable("Progress");

            if (currentword.Contains(sSwitch)) {
                for (int i = 0; i < currentword.Length; i++) {
                    if (currentword[i] == sSwitch) {
                        progress[i] = sSwitch;
                    }
                }
                window.PermaVariables.EditVariable("Progress", progress);

                if (new string(currentword) == new string(progress)) {
                    Win(chatMaster, window);
                    return;
                }
            } else {
                IncrementStage(chatMaster, window);
            }

            AddTriedLetter(window, sSwitch);
            chatMaster.SendMessageToWindow(window, GetProgress(chatMaster, window));
        }
Beispiel #13
0
 private void Win(CChatMaster chatMaster, CWindow window)
 {
     chatMaster.SendMessageToWindow(window, "Congratulations! You won! Hope you had fun! :)");
     Reset(chatMaster, window);
     window.PermaVariables.EditVariable("InGame", false);
 }
Beispiel #14
0
 public void Close(CChatMaster chatMaster, CWindow window)
 {
     chatMaster.SendMessageToWindow(window, "Ok. I've stopped the game!");
     Reset(chatMaster, window);
     window.PermaVariables.EditVariable("InGame", false);
 }
Beispiel #15
0
 private void Reset(CChatMaster chatMaster, CWindow window)
 {
     window.PermaVariables.EditVariable("CurrentHangman", "_______");
     window.PermaVariables.EditVariable("Stage", 0);
     window.PermaVariables.EditVariable("InGame", false);
     ((List<char>)window.PermaVariables.GetVariable("TriedLetters")).Clear();
 }
Beispiel #16
0
 private bool HasTriedLetter(CWindow window, char sSwitch)
 {
     if (((List<char>)window.PermaVariables.GetVariable("TriedLetters")).Contains(sSwitch)) {
         return true;
     }
     return false;
 }
Beispiel #17
0
        private void IncrementStage(CChatMaster chatMaster, CWindow window)
        {
            int stage = (int)window.PermaVariables.GetVariable("Stage");
            string sCurrentHangman = null;

            window.PermaVariables.EditVariable("CurrentHangman", "");
            stage++;

            if (stage == 10) {
                Death(chatMaster, window);
                return;
            }

            switch (stage) {
                case 1:
                    sCurrentHangman = "|     \n|     \n|______";
                    break;

                case 2:
                    sCurrentHangman = "|     \n|     \n|     \n|     \n|______";
                    break;

                case 3:
                    sCurrentHangman = "|/     \n|     \n|     \n|     \n|     \n|     \n|______";
                    break;

                case 4:
                    sCurrentHangman = "___\n|/     \n|     \n|     \n|     \n|     \n|     \n|______";
                    break;

                case 5:
                    sCurrentHangman = "__________\n|/     |\n|     \n|     \n|     \n|     \n|     \n|______";
                    break;

                case 6:
                    sCurrentHangman = "__________\n|/     |\n|     (_)\n|     \n|     \n|     \n|     \n|______";
                    break;

                case 7:
                    sCurrentHangman = "__________\n|/     |\n|     (_)\n|     \\|/\n|\n|\n|\n|______";
                    break;

                case 8:
                    sCurrentHangman = "__________\n|/     |\n|     (_)\n|     \\|/\n|      |\n|\n|\n|______";
                    break;

                case 9:
                    sCurrentHangman = "__________\n|/     |\n|     (_)\n|     \\|/\n|      |\n|     / \\\n|\n|______";
                    break;
            }

            window.PermaVariables.EditVariable("Stage", stage);
            window.PermaVariables.EditVariable("CurrentHangman", sCurrentHangman);
        }
Beispiel #18
0
 private string GetCurrentHangman(CWindow window)
 {
     return (string)window.PermaVariables.GetVariable("CurrentHangman");
 }
Beispiel #19
0
        private void GetRandomWord(CChatMaster chatMaster, CWindow window)
        {
            SetAcceptInput(window, false);
            chatMaster.SendMessageToWindow(window, "Finding a word!");

            WebClient wc = new WebClient();
            wc.DownloadDataCompleted += delegate(object sender, DownloadDataCompletedEventArgs e) {
                this.BeginGame(chatMaster, window, CDataProcess.GetRandomWordFromRaw(e.Result));
                ((WebClient)sender).Dispose();
            };
            wc.DownloadDataAsync(new Uri("http://www.thefreedictionary.com/dictionary.htm"));
        }
Beispiel #20
0
        private void propertyGrid_PropertyValueChanged(object s, PropertyValueChangedEventArgs e)
        {
            if (m_AttrType == AttrType.WindowControl)
            {
                CWindowControl WindowControl = (CWindowControl)ControlEl.Tag;
                IDesignEl      designEl      = (IDesignEl)ControlEl;


                if (designEl.GetCtrlType() == ControlType.NavBar)
                {
                    if (e.ChangedItem.Label == "名称")
                    {
                        WindowControl.Name = e.ChangedItem.Value.ToString();
                    }
                    else if (e.ChangedItem.Label == "停靠")
                    {
                        ControlEl.Dock     = (DockStyle)e.ChangedItem.Value;
                        WindowControl.Dock = (int)ControlEl.Dock;
                    }
                }
                else if (designEl.GetCtrlType() == ControlType.TableGrid)
                {
                    TableGridEl te = (TableGridEl)ControlEl;

                    if (e.ChangedItem.Label == "名称")
                    {
                        WindowControl.Name = e.ChangedItem.Value.ToString();
                    }
                    else if (e.ChangedItem.Label == "停靠")
                    {
                        te.Dock            = (DockStyle)e.ChangedItem.Value;
                        WindowControl.Dock = (int)te.Dock;
                    }
                    else if (e.ChangedItem.Label == "工具栏显示")
                    {
                        te.ShowToolBar = (bool)e.ChangedItem.Value;
                        te.TableInWindowControl.ShowToolBar = te.ShowToolBar;
                        te.TableInWindowControl.m_CmdType   = CmdType.Update;
                    }
                    else if (e.ChangedItem.Label == "标题栏显示")
                    {
                        te.ShowTitleBar = (bool)e.ChangedItem.Value;
                        te.TableInWindowControl.ShowTitleBar = te.ShowTitleBar;
                        te.TableInWindowControl.m_CmdType    = CmdType.Update;
                    }
                }
                else if (designEl.GetCtrlType() == ControlType.TableTree)
                {
                    TableTreeEl tree = (TableTreeEl)ControlEl;
                    if (e.ChangedItem.Label == "名称")
                    {
                        WindowControl.Name = e.ChangedItem.Value.ToString();
                    }
                    else if (e.ChangedItem.Label == "停靠")
                    {
                        tree.Dock          = (DockStyle)e.ChangedItem.Value;
                        WindowControl.Dock = (int)tree.Dock;
                    }
                    else if (e.ChangedItem.Label == "标题栏显示")
                    {
                        tree.ShowTitleBar          = (bool)e.ChangedItem.Value;
                        WindowControl.ShowTitleBar = tree.ShowTitleBar;
                    }
                }
                else if (designEl.GetCtrlType() == ControlType.ListBox)
                {
                    UIListBoxEl list = (UIListBoxEl)ControlEl;
                    if (e.ChangedItem.Label == "名称")
                    {
                        WindowControl.Name = e.ChangedItem.Value.ToString();
                    }
                    else if (e.ChangedItem.Label == "停靠")
                    {
                        list.Dock          = (DockStyle)e.ChangedItem.Value;
                        WindowControl.Dock = (int)list.Dock;
                    }
                    else if (e.ChangedItem.Label == "标题栏显示")
                    {
                        list.ShowTitleBar          = (bool)e.ChangedItem.Value;
                        WindowControl.ShowTitleBar = list.ShowTitleBar;
                    }
                }
                else if (designEl.GetCtrlType() == ControlType.ComboBox)
                {
                    UIComboBoxEl comb = (UIComboBoxEl)ControlEl;
                    if (e.ChangedItem.Label == "名称")
                    {
                        ControlEl.Name     = e.ChangedItem.Value.ToString();
                        WindowControl.Name = e.ChangedItem.Value.ToString();
                    }
                    else if (e.ChangedItem.Label == "停靠")
                    {
                        comb.Dock          = (DockStyle)e.ChangedItem.Value;
                        WindowControl.Dock = (int)comb.Dock;
                    }
                    else if (e.ChangedItem.Label == "标题栏显示")
                    {
                        comb.ShowTitleBar          = (bool)e.ChangedItem.Value;
                        WindowControl.ShowTitleBar = comb.ShowTitleBar;
                    }
                }
                else if (designEl.GetCtrlType() == ControlType.TableTab)
                {
                    TableTabEl tab = (TableTabEl)ControlEl;

                    if (e.ChangedItem.Label == "名称")
                    {
                        WindowControl.Name = e.ChangedItem.Value.ToString();
                    }
                    else if (e.ChangedItem.Label == "停靠")
                    {
                        tab.Dock           = (DockStyle)e.ChangedItem.Value;
                        WindowControl.Dock = (int)tab.Dock;
                    }
                    else if (e.ChangedItem.Label == "工具栏显示")
                    {
                        TableGridEl grid = tab.GetCurTableGridEl();
                        if (grid != null)
                        {
                            grid.ShowToolBar = (bool)e.ChangedItem.Value;
                            grid.TableInWindowControl.ShowToolBar = grid.ShowToolBar;
                            grid.TableInWindowControl.m_CmdType   = CmdType.Update;
                        }
                    }
                    else if (e.ChangedItem.Label == "标题栏显示")
                    {
                        tab.ShowTitleBar           = (bool)e.ChangedItem.Value;
                        WindowControl.ShowTitleBar = tab.ShowTitleBar;
                    }
                }
                WindowControl.m_ObjectMgr.Update(WindowControl);
            }
            else
            {
                CWindow window = (CWindow)WindowEl.Window;
                if (e.ChangedItem.Label == "名称")
                {
                    window.Name = e.ChangedItem.Value.ToString();
                }
                else if (e.ChangedItem.Label == "宽度")
                {
                    WindowEl.Width = (int)e.ChangedItem.Value;
                    window.Width   = WindowEl.Width;
                }
                else if (e.ChangedItem.Label == "高度")
                {
                    WindowEl.Height = (int)e.ChangedItem.Value;
                    window.Height   = WindowEl.Height;
                }
                window.m_ObjectMgr.Update(window);
            }
        }
Beispiel #21
0
        void item_Click(CMenu menu)
        {
            if (menu.MType == enumMenuType.ViewMenu)
            {
                CView view = (CView)Program.Ctx.ViewMgr.Find(menu.UI_View_id);
                if (view != null)
                {
                    CTable table = (CTable)Program.Ctx.TableMgr.Find(view.FW_Table_id);
                    if (table == null)
                    {
                        return;
                    }
                    CBaseObjectMgr objMgr = Program.Ctx.FindBaseObjectMgrCache(table.Code, Guid.Empty);
                    if (objMgr == null)
                    {
                        objMgr        = new CBaseObjectMgr();
                        objMgr.TbCode = table.Code;
                        objMgr.Ctx    = Program.Ctx;
                    }

                    if (view.VType == enumViewType.Single)
                    {
                        SingleView frm = new SingleView();
                        frm.View          = view;
                        frm.BaseObjectMgr = objMgr;
                        frm.Show();
                    }
                    else if (view.VType == enumViewType.MasterDetail)
                    {
                        MasterDetailView frm = new MasterDetailView();
                        frm.View          = view;
                        frm.BaseObjectMgr = objMgr;
                        frm.Show();
                    }
                    else
                    {
                        MultMasterDetailView frm = new MultMasterDetailView();
                        frm.View          = view;
                        frm.BaseObjectMgr = objMgr;
                        frm.Show();
                    }
                }
            }
            else if (menu.MType == enumMenuType.WindowMenu)
            {
                CWindow window = (CWindow)Program.Ctx.WindowMgr.Find(menu.UI_Window_id);
                if (window != null)
                {
                    LayoutWindow frm = new LayoutWindow();
                    frm.Window = window;
                    frm.Show();
                }
            }
            else if (menu.MType == enumMenuType.UrlMenu)
            {
                bool bIsWebUrl = menu.Url.Length > 4 && menu.Url.Substring(0, 4).Equals("http", StringComparison.OrdinalIgnoreCase);
                if (!bIsWebUrl && !File.Exists(menu.Url))
                {
                    MessageBox.Show(string.Format("{0} 不存在!", menu.Url));
                    return;
                }
                System.Diagnostics.Process.Start(menu.Url);
            }
            else if (menu.MType == enumMenuType.ReportMenu)
            {
                CCompany  Company = (CCompany)Program.Ctx.CompanyMgr.Find(Program.User.B_Company_id);
                CReport   Report  = (CReport)Company.ReportMgr.Find(menu.RPT_Report_id);
                RunReport frm     = new RunReport();
                frm.m_Report = Report;
                frm.Show();
            }
        }
Beispiel #22
0
        public void LoadData()
        {
            if (dataGridView == null)
            {
                return;
            }
            if (dataGridView.Columns.Count == 0)
            {
                return;
            }
            dataGridView.Rows.Clear();
            CBaseObjectMgr     BaseObjectMgr = Program.Ctx.WindowMgr;
            List <CBaseObject> lstObj        = BaseObjectMgr.GetList();

            if (lstObj.Count == 0)
            {
                return;
            }
            foreach (CBaseObject obj in lstObj)
            {
                CWindow window = (CWindow)obj;
                if (catalog == null)
                {
                    if (window.UI_WindowCatalog_id != Guid.Empty)
                    {
                        continue;
                    }
                }
                else
                {
                    if (window.UI_WindowCatalog_id != catalog.Id)
                    {
                        continue;
                    }
                }

                dataGridView.Rows.Add(1);
                DataGridViewRow row = dataGridView.Rows[dataGridView.Rows.Count - 1];
                row.Tag = obj;
                foreach (DataGridViewColumn column in dataGridView.Columns)
                {
                    CColumn col = (CColumn)column.Tag;
                    if (col.ColType == ColumnType.object_type)
                    {
                        if (obj.GetColValue(col) != null)
                        {
                            row.Cells[column.Name].Value = "long byte";
                        }
                    }
                    else if (col.ColType == ColumnType.ref_type)
                    {
                        CTable table = (CTable)Program.Ctx.TableMgr.Find(col.RefTable);
                        if (table == null)
                        {
                            continue;
                        }
                        CColumn RefCol     = (CColumn)table.ColumnMgr.Find(col.RefCol);
                        CColumn RefShowCol = (CColumn)table.ColumnMgr.Find(col.RefShowCol);
                        object  objVal     = obj.GetColValue(col);


                        Guid guidParentId = Guid.Empty;
                        if (BaseObjectMgr.m_Parent != null && BaseObjectMgr.m_Parent.Id == (Guid)objVal)
                        {
                            row.Cells[column.Name].Value = BaseObjectMgr.m_Parent.GetColValue(RefShowCol);
                        }
                        else
                        {
                            CBaseObjectMgr objMgr = Program.Ctx.FindBaseObjectMgrCache(table.Code, Guid.Empty);
                            if (objMgr != null)
                            {
                                CBaseObject objCache = objMgr.FindByValue(RefCol, objVal);
                                if (objCache != null)
                                {
                                    row.Cells[column.Name].Value = objCache.GetColValue(RefShowCol);
                                }
                            }
                            else
                            {
                                objMgr        = new CBaseObjectMgr();
                                objMgr.TbCode = table.Code;
                                objMgr.Ctx    = Program.Ctx;

                                string             sWhere   = string.Format(" {0}=?", RefCol.Code);
                                List <DbParameter> cmdParas = new List <DbParameter>();
                                cmdParas.Add(new DbParameter(RefCol.Code, obj.GetColValue(col)));
                                List <CBaseObject> lstObj2 = objMgr.GetList(sWhere, cmdParas);
                                if (lstObj2.Count > 0)
                                {
                                    CBaseObject obj2 = lstObj2[0];
                                    row.Cells[column.Name].Value = obj2.GetColValue(RefShowCol);
                                }
                            }
                        }
                    }
                    else
                    {
                        row.Cells[column.Name].Value = obj.GetColValue(col);
                    }
                }
            }
        }
Beispiel #23
0
        private void btOk_Click(object sender, EventArgs e)
        {
            string sName = txtName.Text.Trim();

            if (sName == "")
            {
                MessageBox.Show("名称不能空!");
                txtName.Focus();
                return;
            }
            if (!sName.Equals(m_Menu.Name, StringComparison.OrdinalIgnoreCase))
            {
                List <CBaseObject> lstObj = Program.Ctx.MenuMgr.GetList();
                foreach (CBaseObject obj in lstObj)
                {
                    CMenu menu = (CMenu)obj;
                    if (m_PMenu == null && menu.Parent_id == Guid.Empty &&
                        sName.Equals(menu.Name, StringComparison.OrdinalIgnoreCase))
                    {
                        MessageBox.Show("名称重复!");
                        txtName.Focus();
                        return;
                    }
                    else if (m_PMenu != null && menu.Parent_id == m_PMenu.Id &&
                             sName.Equals(menu.Name, StringComparison.OrdinalIgnoreCase))
                    {
                        MessageBox.Show("名称重复!");
                        txtName.Focus();
                        return;
                    }
                }
            }
            if (rdType2.Checked)
            {
                if (cbView.SelectedIndex == -1)
                {
                    MessageBox.Show("请选择视图!");
                    return;
                }
            }
            else if (rdType3.Checked)
            {
                if (cbWindow.SelectedIndex == -1)
                {
                    MessageBox.Show("请选择窗体!");
                    return;
                }
            }
            else if (rdType4.Checked)
            {
                if (txtUrl.Text.Trim() == "")
                {
                    MessageBox.Show("请填写url!");
                    txtUrl.Focus();
                    return;
                }
            }
            else if (rdType5.Checked)
            {
                if (cbReport.SelectedIndex == -1)
                {
                    MessageBox.Show("请选择报表!");
                    return;
                }
            }

            m_Menu.Name = sName;
            if (m_PMenu != null)
            {
                m_Menu.Parent_id = m_PMenu.Id;
            }
            if (rdType1.Checked)
            {
                m_Menu.MType = enumMenuType.CatalogMenu;
            }
            else if (rdType2.Checked)
            {
                m_Menu.MType = enumMenuType.ViewMenu;
                DataItem item = (DataItem)cbView.SelectedItem;
                CView    view = (CView)item.Data;
                m_Menu.UI_View_id = view.Id;
            }
            else if (rdType3.Checked)
            {
                m_Menu.MType = enumMenuType.WindowMenu;
                DataItem item   = (DataItem)cbWindow.SelectedItem;
                CWindow  Window = (CWindow)item.Data;
                m_Menu.UI_Window_id = Window.Id;
            }
            else if (rdType4.Checked)
            {
                m_Menu.MType = enumMenuType.UrlMenu;
                m_Menu.Url   = txtUrl.Text.Trim();
            }
            else if (rdType5.Checked)
            {
                m_Menu.MType = enumMenuType.ReportMenu;
                DataItem item   = (DataItem)cbReport.SelectedItem;
                CReport  Report = (CReport)item.Data;
                m_Menu.RPT_Report_id = Report.Id;
            }
            if (File.Exists(picIcon.ImageLocation))
            {
                FileInfo fi = new FileInfo(picIcon.ImageLocation);
                m_Menu.IconUrl = fi.Name;
            }
            else
            {
                m_Menu.IconUrl = "";
            }

            if (m_bIsNew)
            {
                Program.Ctx.MenuMgr.AddNew(m_Menu);
            }
            else
            {
                Program.Ctx.MenuMgr.Update(m_Menu);
            }

            if (!Program.Ctx.MenuMgr.Save(true))
            {
                MessageBox.Show("保存失败!");
                return;
            }

            this.DialogResult = DialogResult.OK;
            this.Close();
        }
Beispiel #24
0
 public void SetAcceptInput(CWindow window, bool bAcceptInput)
 {
     window.PermaVariables.EditVariable("AcceptInput", bAcceptInput);
 }
Beispiel #25
0
        public void Restart(CChatMaster chatMaster, CWindow window)
        {
            chatMaster.SendMessageToWindow(window, "Ok. I'll start a new game!");
            window.PermaVariables.EditVariable("InGame", false);

            Start(chatMaster, window);
        }
Beispiel #26
0
        void LoadData()
        {
            if (m_Menu == null)
            {
                m_bIsNew   = true;
                m_Menu     = new CMenu();
                m_Menu.Ctx = Program.Ctx;
                if (m_PMenu != null)
                {
                    txtParent.Text = m_PMenu.Name;
                }
                return;
            }
            txtName.Text = m_Menu.Name;
            CMenu PMenu = (CMenu)m_Menu.m_ObjectMgr.Find(m_Menu.Parent_id);

            if (PMenu != null)
            {
                txtParent.Text = PMenu.Name;
            }
            if (m_Menu.MType == enumMenuType.CatalogMenu)
            {
                rdType1.Checked = true;
                rdType1_Click(null, null);
            }
            else if (m_Menu.MType == enumMenuType.ViewMenu)
            {
                rdType2.Checked = true;
                rdType2_Click(null, null);
            }
            else if (m_Menu.MType == enumMenuType.WindowMenu)
            {
                rdType3.Checked = true;
                rdType3_Click(null, null);
            }
            else if (m_Menu.MType == enumMenuType.UrlMenu)
            {
                rdType4.Checked = true;
                rdType4_Click(null, null);
            }
            else
            {
                rdType5.Checked = true;
                rdType5_Click(null, null);
            }

            if (m_Menu.MType == enumMenuType.ViewMenu && m_Menu.UI_View_id != Guid.Empty)
            {
                for (int i = 0; i < cbView.Items.Count; i++)
                {
                    DataItem item = (DataItem)cbView.Items[i];
                    CView    view = (CView)item.Data;
                    if (view.Id == m_Menu.UI_View_id)
                    {
                        cbView.SelectedIndex = i;
                        break;
                    }
                }
            }
            if (m_Menu.MType == enumMenuType.WindowMenu && m_Menu.UI_Window_id != Guid.Empty)
            {
                for (int i = 0; i < cbWindow.Items.Count; i++)
                {
                    DataItem item   = (DataItem)cbWindow.Items[i];
                    CWindow  Window = (CWindow)item.Data;
                    if (Window.Id == m_Menu.UI_Window_id)
                    {
                        cbWindow.SelectedIndex = i;
                        break;
                    }
                }
            }
            txtUrl.Text = m_Menu.Url;
            if (m_Menu.MType == enumMenuType.ReportMenu && m_Menu.RPT_Report_id != Guid.Empty)
            {
                for (int i = 0; i < cbReport.Items.Count; i++)
                {
                    DataItem item   = (DataItem)cbReport.Items[i];
                    CReport  Report = (CReport)item.Data;
                    if (Report.Id == m_Menu.RPT_Report_id)
                    {
                        cbReport.SelectedIndex = i;
                        break;
                    }
                }
            }
            if (m_Menu.IconUrl != "")
            {
                string sPath = Application.StartupPath + "\\MenuIcon\\";
                picIcon.ImageLocation = sPath + m_Menu.IconUrl;
            }
        }
Beispiel #27
0
 public void Start(CChatMaster chatMaster, CWindow window)
 {
     Reset(chatMaster, window);
     GetRandomWord(chatMaster, window);
 }
Beispiel #28
0
 /// <summary>
 /// Handles the full main tick.
 /// </summary>
 /// <param name="delt">The current delta timings (See Delta).</param>
 void Tick(double delt)
 {
     lock (TickLock)
     {
         Delta = delt * CVars.g_timescale.ValueD;
         GlobalTickTimeLocal  += Delta;
         Engine.GlobalTickTime = GlobalTickTimeLocal;
         try
         {
             opsat += Delta;
             if (opsat >= 1)
             {
                 opsat -= 1;
                 OncePerSecondActions();
             }
             Schedule.RunAllSyncTasks(Delta);
             Textures.Update(GlobalTickTimeLocal);
             Shaders.Update(GlobalTickTimeLocal);
             Models.Update(GlobalTickTimeLocal);
             KeyHandler.Tick();
             if (RawGamePad != null)
             {
                 for (int i = 0; i < 4; i++)
                 {
                     if (GamePad.GetCapabilities(i).IsConnected)
                     {
                         RawGamePad.SetVibration(i, GamePadVibration, GamePadVibration);
                     }
                 }
             }
             Gamepad.Tick(Delta);
             MouseHandler.Tick();
             UIConsole.Tick();
             Commands.Tick();
             TickWorld(Delta);
             TickChatSystem();
             TickInvMenu();
             CWindow.ClientEngineTick();
             CWindow.MouseX = MouseHandler.MouseX();
             CWindow.MouseY = MouseHandler.MouseY();
             CScreen.FullTick(Delta);
             Sounds.Update(MainWorldView.CameraPos, MainWorldView.CameraTarget - MainWorldView.CameraPos, MainWorldView.CameraUp(), Player.GetVelocity(), Window.Focused);
             Schedule.RunAllSyncTasks(0);
             Player.PostTick();
             TheRegion.SolveJoints();
             //ProcessChunks();
         }
         catch (Exception ex)
         {
             SysConsole.Output(OutputType.ERROR, "Ticking: " + ex.ToString());
         }
         PlayerEyePosition = Player.ItemSource();
         Location forw = Player.ItemDir();
         bool     h    = TheRegion.SpecialCaseRayTrace(PlayerEyePosition, forw, 100, MaterialSolidity.ANY, IgnorePlayer, out RayCastResult rcr);
         Location loc  = new Location(rcr.HitData.Location);
         Location nrm  = new Location(rcr.HitData.Normal);
         h = h && !loc.IsInfinite() && !loc.IsNaN() && nrm.LengthSquared() > 0;
         if (h)
         {
             nrm = nrm.Normalize();
         }
         CameraFinalTarget  = h ? loc - nrm * 0.01: PlayerEyePosition + forw * 100;
         CameraImpactNormal = h ? new Location(rcr.HitData.Normal).Normalize() : Location.Zero;
         CameraDistance     = h ? rcr.HitData.T: 100;
         if (CameraDistance <= 0.01)
         {
             CameraDistance = 0.01;
         }
         double cping = Math.Max(LastPingValue, GlobalTickTimeLocal - LastPingTime);
         AveragePings.Push(new KeyValuePair <double, double>(GlobalTickTimeLocal, cping));
         while ((GlobalTickTimeLocal - AveragePings.Peek().Key) > 1)
         {
             AveragePings.Pop();
         }
         APing = 0;
         for (int i = 0; i < AveragePings.Length; i++)
         {
             APing += AveragePings[i].Value;
         }
         APing /= (double)AveragePings.Length;
         if (FogEnhanceTime > 0.0)
         {
             FogEnhanceTime -= Delta;
         }
         else
         {
             FogEnhanceTime = 0.0;
         }
     }
 }
Beispiel #29
0
    void LoadData()
    {
        txtName.Value = m_BaseObject.Name;
        if (m_BaseObject.Parent_id != Guid.Empty)
        {
            CMenu pmenu = (CMenu)Global.GetCtx(Session["TopCompany"].ToString()).MenuMgr.Find(m_BaseObject.Parent_id);
            if (pmenu != null)
            {
                txtParent.Value = pmenu.Name;
                hidParent.Value = pmenu.Id.ToString();
            }
        }
        else
        {
            txtParent.Value = "菜单";
        }

        if (m_BaseObject.MType == enumMenuType.CatalogMenu)
        {
            rdType1.Checked = true;
            cbView.Attributes.Add("disabled", "disabled");
            cbWindow.Attributes.Add("disabled", "disabled");
            txtUrl.Attributes.Add("disabled", "disabled");
            cbReport.Attributes.Add("disabled", "disabled");
        }
        else if (m_BaseObject.MType == enumMenuType.ViewMenu)
        {
            rdType2.Checked = true;
            CView view = (CView)Global.GetCtx(Session["TopCompany"].ToString()).ViewMgr.Find(m_BaseObject.UI_View_id);
            if (view != null)
            {
                cbView.Value  = view.Name;
                hidView.Value = m_BaseObject.UI_View_id.ToString();
            }
            cbWindow.Attributes.Add("disabled", "disabled");
            txtUrl.Attributes.Add("disabled", "disabled");
            cbReport.Attributes.Add("disabled", "disabled");
        }
        else if (m_BaseObject.MType == enumMenuType.WindowMenu)
        {
            rdType3.Checked = true;
            cbView.Attributes.Add("disabled", "disabled");
            CWindow window = (CWindow)Global.GetCtx(Session["TopCompany"].ToString()).WindowMgr.Find(m_BaseObject.UI_Window_id);
            if (window != null)
            {
                cbWindow.Value  = window.Name;
                hidWindow.Value = m_BaseObject.UI_Window_id.ToString();
            }
            txtUrl.Attributes.Add("disabled", "disabled");
            cbReport.Attributes.Add("disabled", "disabled");
        }
        else if (m_BaseObject.MType == enumMenuType.UrlMenu)
        {
            rdType4.Checked = true;
            cbView.Attributes.Add("disabled", "disabled");
            cbWindow.Attributes.Add("disabled", "disabled");
            txtUrl.Value = m_BaseObject.Url;
            cbReport.Attributes.Add("disabled", "disabled");
        }
        else if (m_BaseObject.MType == enumMenuType.ReportMenu)
        {
            rdType5.Checked = true;
            cbView.Attributes.Add("disabled", "disabled");
            cbWindow.Attributes.Add("disabled", "disabled");
            txtUrl.Attributes.Add("disabled", "disabled");
            CUser    user    = (CUser)Session["User"];
            CCompany Company = (CCompany)Global.GetCtx(Session["TopCompany"].ToString()).CompanyMgr.Find(user.B_Company_id);
            CReport  Report  = (CReport)Company.ReportMgr.Find(m_BaseObject.RPT_Report_id);
            if (Report != null)
            {
                cbReport.Value  = Report.Name;
                hidReport.Value = m_BaseObject.RPT_Report_id.ToString();
            }
        }
        imgIcon.Src = string.Format("../{0}/MenuIcon/default.png", Global.GetDesktopIconPathName());
        //菜单图标
        if (m_BaseObject.IconUrl != "")
        {
            string sPath = ConfigurationManager.AppSettings["VirtualDir"] + "/";
            sPath        += Global.GetDesktopIconPathName() + "/";
            sPath        += "MenuIcon/";
            imgIcon.Src   = sPath + m_BaseObject.IconUrl;
            hidIcon.Value = m_BaseObject.IconUrl;
        }
        txtOpenwinWidth.Value  = m_BaseObject.OpenwinWidth.ToString();
        txtOpenwinHeight.Value = m_BaseObject.OpenwinHeight.ToString();
    }
Beispiel #30
0
        private void AddTriedLetter(CWindow window, char sSwitch)
        {
            List<char> tried = (List<char>)window.PermaVariables.GetVariable("TriedLetters");
            if (!tried.Contains(sSwitch)) {
                tried.Add(sSwitch);
            }

            window.PermaVariables.EditVariable("TriedLetters", tried);
        }
Beispiel #31
0
        private void BeginGame(CChatMaster chatMaster, CWindow window, string strWord)
        {
            char[] word = strWord.ToCharArray();
            char[] progress = new char[word.Length];

            window.PermaVariables.EditVariable("CurrentWord", word);

            for (int i = 0; i < progress.Length; i++) {
                progress[i] = '_';
            }

            window.PermaVariables.EditVariable("Progress", progress);
            window.PermaVariables.EditVariable("InGame", true);
            SetAcceptInput(window, true);
            chatMaster.SendMessageToWindow(window, "Remember you can stop at any time by typing 'stop'.\n" + GetProgress(chatMaster, window));
        }
Beispiel #32
0
 private void Death(CChatMaster chatMaster, CWindow window)
 {
     chatMaster.SendMessageToWindow(window, "Oh dear! You got hung! The word was " +
         new string((char[])window.PermaVariables.GetVariable("CurrentWord")) + ". Maybe you should try again?");
     Reset(chatMaster, window);
     window.PermaVariables.EditVariable("InGame", false);
 }
Beispiel #33
0
        static void Main()
        {
            CWindow pWindow = new CWindow();

            pWindow.Create();
        }
Beispiel #34
0
        private void tbtEdit_Click(object sender, EventArgs e)
        {
            if (dataGridView.CurrentRow == null)
            {
                MessageBox.Show("请选择一项!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            CWindow obj = (CWindow)dataGridView.CurrentRow.Tag;

            RecordWindow frm = new RecordWindow(Program.Ctx.WindowMgr, obj);

            if (frm.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            CBaseObjectMgr BaseObjectMgr = Program.Ctx.WindowMgr;

            DataGridViewRow row = dataGridView.CurrentRow;

            foreach (DataGridViewColumn column in dataGridView.Columns)
            {
                CColumn col = (CColumn)column.Tag;
                if (col.ColType == ColumnType.object_type)
                {
                    if (obj.GetColValue(col) != null)
                    {
                        row.Cells[column.Name].Value = "long byte";
                    }
                }
                else if (col.ColType == ColumnType.ref_type)
                {
                    CTable table = (CTable)Program.Ctx.TableMgr.Find(col.RefTable);
                    if (table == null)
                    {
                        continue;
                    }
                    CColumn RefCol     = (CColumn)table.ColumnMgr.Find(col.RefCol);
                    CColumn RefShowCol = (CColumn)table.ColumnMgr.Find(col.RefShowCol);
                    object  objVal     = obj.GetColValue(col);


                    Guid guidParentId = Guid.Empty;
                    if (BaseObjectMgr.m_Parent != null && BaseObjectMgr.m_Parent.Id == (Guid)objVal)
                    {
                        row.Cells[column.Name].Value = BaseObjectMgr.m_Parent.GetColValue(RefShowCol);
                    }
                    else
                    {
                        CBaseObjectMgr objMgr = Program.Ctx.FindBaseObjectMgrCache(table.Code, Guid.Empty);
                        if (objMgr != null)
                        {
                            CBaseObject objCache = objMgr.FindByValue(RefCol, objVal);
                            if (objCache != null)
                            {
                                row.Cells[column.Name].Value = objCache.GetColValue(RefShowCol);
                            }
                        }
                        else
                        {
                            objMgr        = new CBaseObjectMgr();
                            objMgr.TbCode = table.Code;
                            objMgr.Ctx    = Program.Ctx;

                            string             sWhere   = string.Format(" {0}=?", RefCol.Code);
                            List <DbParameter> cmdParas = new List <DbParameter>();
                            cmdParas.Add(new DbParameter(RefCol.Code, obj.GetColValue(col)));
                            List <CBaseObject> lstObj2 = objMgr.GetList(sWhere, cmdParas);
                            if (lstObj2.Count > 0)
                            {
                                CBaseObject obj2 = lstObj2[0];
                                row.Cells[column.Name].Value = obj2.GetColValue(RefShowCol);
                            }
                        }
                    }
                }
                else
                {
                    row.Cells[column.Name].Value = obj.GetColValue(col);
                }
            }
        }