Пример #1
0
        /// <summary>
        /// 检测记录
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ButtonRecord_Click(object sender, RoutedEventArgs e)
        {
            RecordWindow window = new RecordWindow();

            window.ComboBoxUser.Text = LoginWindow._userAccount.UserName;
            window.ShowInTaskbar     = false; window.Owner = this; window.Show();
        }
Пример #2
0
    private void ShowScore(SocketIOEvent e)
    {
        Debug.Log("[ShowScore] returned: " + e.data);

        RecordWindow recordWindow = windowManager.Open((int)Windows.RecordWindow - 1, false) as RecordWindow;

        recordWindow.SetValues(e.data["wins"].ToString(), e.data["losses"].ToString(), e.data["streak"].ToString(), e.data["score"].ToString());
    }
Пример #3
0
 public void OpenRecordWindow()
 {
     if (RecordWindow != null)
     {
         RecordWindow.Close();
     }
     RecordWindow = new RecordWindow();
     RecordWindow.Show();
 }
Пример #4
0
 public void ShowRecordWindowTest()
 {
     recordWindow = new RecordWindow();
     recordWindow.Show();
     if (recordWindow.IsVisible == false)
     {
         Assert.Fail();
     }
     else
     {
         recordWindow.Hide();
         Assert.Pass();
     }
 }
Пример #5
0
        public void ShowView(IEntity entity)
        {
            var window = GetRecordWindow();

            if (window != null)
            {
                window.Navigate(entity);
            }
            else
            {
                window = new RecordWindow(entity);

                window.ShowDialog();
            }
        }
Пример #6
0
 public void InitialRecordWindowTest()
 {
     Setup();
     recordWindow = new RecordWindow();
     Assert.NotNull(recordWindow);
 }
Пример #7
0
 public void Setup()
 {
     mainWindow   = new MainWindow();
     recordWindow = new RecordWindow();
     searchWindow = new SearchWindow();
 }
 public void StoreParentThrowsIOExceptionIfInvalidConnectionStringTest()
 {
     recordWindow = new RecordWindow();
     Assert.ThrowsException <InvalidOperationException>(() => recordWindow.StoreParent(""));
 }
 public void RetrieveRecordsThrowsIOExceptionIfInvalidConnectionStringAndIDTest()
 {
     recordWindow = new RecordWindow();
     Assert.ThrowsException <InvalidOperationException>(() => recordWindow.RetrieveRecords("", ""));
 }
Пример #10
0
 public void InitialRecordWindowTest()
 {
     recordWindow = new RecordWindow();
     Assert.NotNull(recordWindow);
     Assert.IsInstanceOf <WpfApp.RecordWindow>(recordWindow, "This test failed due to a failed instance of recordWindow being an instance of RecordWindow");
 }
Пример #11
0
        private void tbtEdit_Click(object sender, EventArgs e)
        {
            if (dataGridView.CurrentRow == null)
            {
                MessageBox.Show("请选择一项!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            CBaseObject obj = (CBaseObject)dataGridView.CurrentRow.Tag;

            RecordWindow frm = new RecordWindow(BaseObjectMgr, obj);

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

            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);
                }
            }
        }
Пример #12
0
        private void tbtNew_Click(object sender, EventArgs e)
        {
            RecordWindow frm = new RecordWindow(BaseObjectMgr, null);

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

            CBaseObject obj = frm.BaseObject;

            dataGridView.Rows.Add(1);
            DataGridViewRow row = dataGridView.Rows[dataGridView.Rows.Count - 1];

            row.Tag = obj;
            foreach (DataGridViewColumn column in dataGridView.Columns)
            {
                //工作流
                if (column.Name.Equals("workflow"))
                {
                    continue;
                }
                //
                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);
                }
            }
        }
        private void OnKeyPressed(object sender, GlobalKeyboardHookEventArgs e)
        {
            //Debug.WriteLine(e.KeyboardData.VirtualCode);


            if (
                //e.KeyboardData.VirtualCode != GlobalKeyboardHook.VkSnapshot
                //&& e.KeyboardData.VirtualCode != GlobalKeyboardHook.RightAlt
                e.KeyboardData.VirtualCode != GlobalKeyboardHook.F11)
            //if (e.KeyboardState == GlobalKeyboardHook.KeyboardState.SysKeyDown &&
            //    e.KeyboardData.Flags == GlobalKeyboardHook.LlkhfAltdown)
            {
                return;
            }


            // seems, not needed in the life.
            //if (e.KeyboardState == GlobalKeyboardHook.KeyboardState.SysKeyDown &&
            //    e.KeyboardData.Flags == GlobalKeyboardHook.LlkhfAltdown)
            //{
            //    MessageBox.Show("Alt + Print Screen");
            //    e.Handled = true;
            //}
            //else

            var now = DateTime.Now;

            //因為按鍵持續按下時會極快的持續重複引發這個事件  大約 150ms引發一次
            //所以 如果距離上一次引發大於500ms 就判定是新的一次按下  就重新開始計時
            if (now.Subtract(instantKeyPressTime).TotalMilliseconds > 500)
            {
                timerStart = now;
            }

            instantKeyPressTime = now;

            if (e.KeyboardState == GlobalKeyboardHook.KeyboardState.KeyDown)
            {
                Tbx.Text += DateTime.Now.ToString("T") + "KeyDown\n   " + ++i;
                //持續按下的時間長度大於一定秒數
                if (now.Subtract(timerStart).TotalMilliseconds > 1000)
                {
                    timerStart = now;
                    topProcess = ProcessFocus.FindTopProcess();

                    RecordWindow recordWindow = new RecordWindow();
                    recordWindow.Show();
                    recordWindow.Activate();
                    recordWindow.Closing += (o, args) =>
                    {
                        try
                        {
                            ProcessFocus.SendPasteToSpecifcProcessAndSetForeground(topProcess.Id);
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show(ex.ToString());
                        }
                    };


                    //MessageBox.Show("Key Down last for 1 seconds,\ntopProcess: "+ProcessFocus.FindTopProcess().ProcessName);
                }
                e.Handled = true;
            }
        }