public static void Main()
	{
                try {
  		    Dlg d = new Dlg(new B().GetSecureField);
                    Console.WriteLine(d());
                    Console.WriteLine("FAILED: Verification exception not thrown");
                    Environment.Exit(1);
                }
                catch (VerificationException) {
                    Console.WriteLine("PASSED: Verification exception thrown");
                    Environment.Exit(0);
                }
                Console.WriteLine("FAILED: unexpected");
                Environment.Exit(1);
	}
        public void Show(BattleCommand iCommand, Action onFinished)
        {
            int num = _nIndex = ((iCommand != BattleCommand.None) ? _listCommandUnitLabel.Find((UICommandLabelButton x) => x.battleCommand == iCommand).index : 0);

            _listCommandUnitLabel.ForEach(delegate(UICommandLabelButton x)
            {
                x.isFocus = ((x.index == _nIndex) ? true : false);
            });
            base.transform.LTCancel();
            float         time = 0.15f;
            LeanTweenType ease = LeanTweenType.linear;

            base.transform.localScale = Vector3.one * 0.8f;
            base.transform.LTScale(Vector3.one, time).setEase(ease);
            base.transform.LTValue(widget.alpha, 1f, time).setEase(ease).setOnUpdate(delegate(float x)
            {
                widget.alpha = x;
            })
            .setOnComplete((Action) delegate
            {
                isColliderEnabled = true;
                Dlg.Call(ref onFinished);
            });
        }
示例#3
0
        private void UpdateEXP(int nowEXPRate, Queue <int> exp, float intervalTime, Action callback)
        {
            int num = exp.Dequeue();

            _uiEXPSlider.transform.LTValue(nowEXPRate, num, intervalTime).setEase(LeanTweenType.linear).setOnUpdate(delegate(float x)
            {
                _uiEXPSlider.value = x / 100f;
                if (_uiEXPSlider.value == 1f)
                {
                    PlayLevelUp();
                }
            })
            .setOnComplete((Action) delegate
            {
                if (exp.Count != 0)
                {
                    UpdateEXP(0, exp, intervalTime, callback);
                }
                else
                {
                    Dlg.Call(ref callback);
                }
            });
        }
        public bool Run()
        {
            KeyControl keyControl = StartupTaskManager.GetKeyControl();

            Main.Update();
            if (keyControl.GetDown(KeyControl.KeyName.SELECT))
            {
                OnNameSubmit();
                return(true);
            }
            if (keyControl.GetDown(KeyControl.KeyName.MARU))
            {
                if (_uiNameInput.value == string.Empty || _uiNameInput.value.Replace(" ", string.Empty).Replace("\u3000", string.Empty) == string.Empty)
                {
                    _strEditName       = string.Empty;
                    _uiNameInput.value = string.Empty;
                    OnClickInputLabel();
                }
                else if (Utils.ChkNGWard(_uiNameInput.value))
                {
                    _uiNameInput.value = string.Empty;
                    _animFeather.Play();
                    OnClickInputLabel();
                }
                else
                {
                    _uiNameInput.isSelected = false;
                    OnNameSubmit();
                }
            }
            else if (keyControl.GetDown(KeyControl.KeyName.BATU))
            {
                Dlg.Call(ref _actOnCancel);
            }
            return(true);
        }
        public void PlayLostAnim(Action onFinished)
        {
            this.widget.get_transform().LTValue(0f, 1f, 0.5f).setEase(LeanTweenType.linear).setOnUpdate(delegate(float x)
            {
                this.widget.alpha = x;
            });
            Bezier bezier = new Bezier(Bezier.BezierType.Quadratic, Vector3.get_zero(), new Vector3(-75f, -60f, 0f), new Vector3(-45f, 100f, 0f), Vector3.get_zero());

            base.get_transform().LTValue(0f, 1f, 2f).setEase(LeanTweenType.linear).setOnUpdate(delegate(float x)
            {
                this.get_transform().set_localPosition(bezier.Interpolate(x));
            });
            Observable.Timer(TimeSpan.FromSeconds(1.2000000476837158)).Subscribe(delegate(long _)
            {
                this.widget.get_transform().LTValue(1f, 0f, 0.5f).setEase(LeanTweenType.linear).setOnUpdate(delegate(float x)
                {
                    this.widget.alpha = x;
                }).setOnComplete(delegate
                {
                    Object.Destroy(this.get_gameObject());
                });
                Dlg.Call(ref onFinished);
            });
        }
示例#6
0
        /// <summary>
        /// 显示聊天对话框
        /// </summary>
        /// <param name="p_otherID">对方ID</param>
        /// <param name="p_otherName">null时自动查询</param>
        public static void ShowDlg(long p_otherID, string p_otherName = null)
        {
            if (string.IsNullOrEmpty(p_otherName))
            {
                p_otherName = AtState.GetScalar <string>($"select name from ChatMember where id={p_otherID}");
                if (string.IsNullOrEmpty(p_otherName))
                {
                    p_otherName = p_otherID.ToString();
                }
            }

            Dlg dlg;

            if (Kit.IsPhoneUI)
            {
                dlg = new Dlg {
                    Title = p_otherName,
                };
            }
            else
            {
                dlg = new Dlg()
                {
                    IsPinned = true,
                    Height   = 500,
                    Width    = 400,
                    Title    = p_otherName,
                };
            }

            ChatDetail chat = new ChatDetail();

            chat.OtherID = p_otherID;
            dlg.Content  = chat;
            dlg.Show();
        }
示例#7
0
 private void DecideAdvancinsWithDrawalBtn(UIHexButton btn)
 {
     if (BattleTaskManager.IsSortieBattle())
     {
         SingletonMonoBehaviour <AppInformation> .Instance.NextLoadScene = ((btn.index != 0) ? Generics.Scene.SortieAreaMap : Generics.Scene.Strategy);
         SingletonMonoBehaviour <FadeCamera> .Instance.isDrawNowLoading  = (SingletonMonoBehaviour <AppInformation> .Instance.NextLoadScene == Generics.Scene.SortieAreaMap);
         SingletonMonoBehaviour <FadeCamera> .Instance.FadeOut(0.2f, delegate
         {
             if (btn.index == 1)
             {
                 TrophyUtil.Unlock_At_GoNext();
                 RetentionData.SetData(BattleUtils.GetRetentionDataAdvancingWithdrawalDC(SortieBattleTaskManager.GetMapManager(), ShipRecoveryType.Personnel));
                 Dlg.Call <ShipRecoveryType>(ref this._actOnGotoSortieMap, ShipRecoveryType.Personnel);
             }
             else if (btn.index == 2)
             {
                 TrophyUtil.Unlock_At_GoNext();
                 RetentionData.SetData(BattleUtils.GetRetentionDataAdvancingWithdrawalDC(SortieBattleTaskManager.GetMapManager(), ShipRecoveryType.Goddes));
                 Dlg.Call <ShipRecoveryType>(ref this._actOnGotoSortieMap, ShipRecoveryType.Goddes);
             }
             else if (btn.index == 3)
             {
                 MapManager mapManager = SortieBattleTaskManager.GetMapManager();
                 mapManager.ChangeCurrentDeck();
                 RetentionData.SetData(BattleUtils.GetRetentionDataAdvancingWithdrawalDC(mapManager, ShipRecoveryType.None));
                 Dlg.Call <ShipRecoveryType>(ref this._actOnGotoSortieMap, ShipRecoveryType.None);
             }
             else
             {
                 RetentionData.SetData(BattleUtils.GetRetentionDataAdvancingWithdrawalDC(SortieBattleTaskManager.GetMapManager(), ShipRecoveryType.None));
                 SingletonMonoBehaviour <AppInformation> .Instance.NextLoadScene = Generics.Scene.Strategy;
                 Application.LoadLevel(Generics.Scene.LoadingScene.ToString());
             }
         });
     }
 }
 public void Show(Action callback)
 {
     panel.widgetsAreStatic = false;
     _listSelectorObjects.ForEach(delegate(IRebellionOrganizeSelectObject x)
     {
         Action onComplete = null;
         if (x.index == _uiSortieStartBtn.index)
         {
             onComplete = delegate
             {
                 Observable.Timer(TimeSpan.FromSeconds(0.029999999329447746)).Subscribe(delegate
                 {
                     Dlg.Call(ref callback);
                 });
             };
         }
         if (x.button.transform.LTIsTweening())
         {
             x.button.transform.LTCancel();
         }
         x.button.transform.LTMoveLocal(_listInfosPos[x.index], 0.2f).setEase(LeanTweenType.easeInSine).setDelay((float)x.index * 0.03f)
         .setOnComplete(onComplete);
     });
 }
示例#9
0
        public static void StartBattle(BattleFormationKinds1 formationKind)
        {
            if (!(BattleCutManager._clsBattleManager is PracticeBattleManager))
            {
                if (BattleCutManager._clsMapManger is SortieMapManager)
                {
                    BattleCutManager._clsBattleManager = ((SortieMapManager)BattleCutManager._clsMapManger).BattleStart(formationKind);
                }
                else
                {
                    BattleCutManager._clsBattleManager = ((RebellionMapManager)BattleCutManager._clsMapManger).BattleStart(formationKind);
                }
            }
            switch (BattleCutManager._clsBattleManager.WarType)
            {
            case enumMapWarType.None:
                Dlg.Call(ref BattleCutManager._actOnFinished);
                break;

            case enumMapWarType.Normal:
                BattleCutManager.ReqPhase(BattleCutPhase.Command);
                break;

            case enumMapWarType.Midnight:
                BattleCutManager.ReqPhase(BattleCutPhase.NightBattle);
                break;

            case enumMapWarType.Night_To_Day:
                BattleCutManager.ReqPhase(BattleCutPhase.NightBattle);
                break;

            case enumMapWarType.AirBattle:
                BattleCutManager.ReqPhase(BattleCutPhase.Command);
                break;
            }
        }
示例#10
0
 private void GotoSortieMap(ShipRecoveryType iType)
 {
     Dlg.Call(ref _actOnFinished, iType);
 }
示例#11
0
 private void taskm_Completed(object sender, TaskCompletedEventArgs <bool> e)
 {
     logger.Log(Resources.ResetCompleted, Category.Debug, Priority.None);
     Dlg.Result = true;
     Dlg.Close();
 }
示例#12
0
        private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            try
            {
                if (blZhuxiao == false)
                {
                    if (Dlg.ShowConfirmInfo("确定退出系统?") == System.Windows.Forms.DialogResult.No)
                    {
                        e.Cancel = true;
                        return;
                    }
                    else
                    {
                        e.Cancel = false;
                        //return;

                        #region 取数据库备份参数
                        int    backupMode;
                        string backupPath;

                        string lsql = string.Format("SELECT IntCode,VcParam1 from SysParam where IntType=1");
                        using (DataTable dt = SqlHelper.GetData(lsql))
                        {
                            if (dt.Rows.Count == 0)
                            {
                                Dlg.ShowErrorInfoAndHelp("第一次使用,请设置数据库备份参数!");
                                e.Cancel = true;
                                return;
                            }
                            else
                            {
                                backupMode = Utils.StrToIntDef(dt.Rows[0]["IntCode"].ToString(), -1);
                                backupPath = Convert.ToString(dt.Rows[0]["VcParam1"]).Trim();
                            }

                            if ((backupMode < 0) || (backupMode > 2))
                            {
                                Dlg.ShowErrorInfo("数据库“备份选项”不正确,请设置!");
                                e.Cancel = true;
                                return;
                            }

                            if (backupMode != 2)
                            {
                                if (string.IsNullOrEmpty(backupPath) == true)
                                {
                                    if (Dlg.ShowConfirmInfo("数据库备份路径为空,请设置!") == System.Windows.Forms.DialogResult.Yes)
                                    {
                                        e.Cancel = true;
                                        return;
                                    }
                                }
                                if ((!Directory.Exists(backupPath)) && CommonClass.SttDb.iDBType == 0)
                                {
                                    if (Dlg.ShowConfirmInfo("数据库备份路径在本机不存在,请设置!") == System.Windows.Forms.DialogResult.Yes)
                                    {
                                        e.Cancel = true;
                                        return;
                                    }
                                }
                            }
                        }
                        #endregion

                        #region 备份
                        if (CommonClass.SttDb.iDBType == 0)
                        {
                            string dbFullName = Application.StartupPath + @"\DbMeter.mdb";
                            Cursor.Current = Cursors.WaitCursor;
                            CopyFileClass.Backup(backupMode, dbFullName, backupPath);
                            Cursor.Current = Cursors.Default;
                        }
                        else
                        {
                            if (backupMode == 0)
                            {
                                if (Dlg.ShowConfirmInfo("是否备份数据库") == System.Windows.Forms.DialogResult.Yes)
                                {
                                    Cursor.Current = Cursors.WaitCursor;
                                    string dbFullName = backupPath + "\\dbmeter" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".bak";
                                    System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex(@"\(.*?\)");
                                    string dbName = regex.Match(CommonClass.SttDb.sDbInfo).ToString().Trim('(', ')');
                                    string mSql   = string.Empty;
                                    mSql = string.Format(@"BACKUP DATABASE {0} TO  DISK = N'{1}' WITH  INIT ,  NOUNLOAD , NAME = N'{0}备份',NOSKIP , STATS = 10, NOFORMAT", dbName, dbFullName);
                                    SqlHelper.ExecuteNonQuery(mSql);
                                    Cursor.Current = Cursors.Default;
                                }
                            }
                            else if (backupMode == 1)
                            {
                                Cursor.Current = Cursors.WaitCursor;
                                string dbFullName = backupPath + "\\dbmeter" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".bak";
                                System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex(@"\(.*?\)");
                                string dbName = regex.Match(CommonClass.SttDb.sDbInfo).ToString().Trim('(', ')');
                                string mSql   = string.Empty;
                                mSql = string.Format(@"BACKUP DATABASE {0} TO  DISK = N'{1}' WITH  INIT ,  NOUNLOAD , NAME = N'{0}备份',NOSKIP , STATS = 10, NOFORMAT", dbName, dbFullName);
                                SqlHelper.ExecuteNonQuery(mSql);
                                Cursor.Current = Cursors.Default;
                            }
                        }
                        #endregion

                        //关闭启动窗体
                        myLogin.Close();
                    }
                }
            }
            catch (Exception ex)
            {
                Dlg.ShowErrorInfo(ex.Message);
                e.Cancel = true;
                return;
            }
        }
示例#13
0
        private void LoadModuleListFromXml()
        {
            XmlDocument mXml = new XmlDocument();

            if (System.IO.File.Exists("System.xml") == false)
            {
                Dlg.ShowErrorInfoAndHelp("没有发现配置文档");
                return;
            }
            mXml.Load("System.xml");
            XmlNode mConfigNode = mXml.SelectSingleNode("/Config/ConfigFile");

            if (mConfigNode == null)
            {
                Dlg.ShowErrorInfoAndHelp("配置文件有误");
                return;
            }

            if (System.IO.File.Exists(mConfigNode.Attributes["FileName"].Value) == false)
            {
                Dlg.ShowErrorInfoAndHelp("没有发现配置文档");
                return;
            }
            mXml.Load(mConfigNode.Attributes["FileName"].Value);

            XmlNodeList mNodeList = mXml.SelectNodes("/Config/menus");

            for (int i = 0; i < mNodeList.Count; i++)
            {
                XmlNode mNode     = mNodeList[i];
                Image   imageTemp = null;
                string  strText   = "缺省值";
                string  strName;
                if (mNode.Attributes["imagePath"].Value != null)
                {
                    imageTemp = Image.FromFile(mNode.Attributes["imagePath"].Value);
                }
                else
                {
                    imageTemp = Image.FromFile(@"Images\1.png");
                }
                if (mNode.Attributes["text"].Value != null)
                {
                    strText = mNode.Attributes["text"].Value;
                }
                if (mNode.Attributes["name"].Value != null)
                {
                    strName = mNode.Attributes["name"].Value;
                }
                else
                {
                    strName = new Guid().ToString();
                }

                ToolStripButton tsbMain = new ToolStripButton(strText, imageTemp, new EventHandler(mtoolStripButton1_Click), strName); //新建菜单主项按钮
                tsbMain.DisplayStyle      = ToolStripItemDisplayStyle.Image;
                tsbMain.TextImageRelation = TextImageRelation.ImageAboveText;

                ToolStrip tsTemp = new ToolStrip(); // 新建侧边栏
                tsTemp.Name             = "ts" + mNode.Attributes["text"].Value;
                tsTemp.Visible          = false;
                tsTemp.ImageScalingSize = new Size(32, 32);
                tsTemp.BackColor        = System.Drawing.Color.FromArgb(192, 220, 255);
                tsTemp.Dock             = DockStyle.Fill;
                tsTemp.GripStyle        = ToolStripGripStyle.Hidden;
                tsTemp.LayoutStyle      = ToolStripLayoutStyle.VerticalStackWithOverflow;
                tsTemp.Parent           = splitContainer1.Panel1;

                //新建菜单栏
                ToolStripMenuItem tsmiTemp = new ToolStripMenuItem(mNode.Attributes["text"].Value);
                tsmiTemp.Name = "tsmi" + mNode.Attributes["text"].Value;
                MenuMain.Items.Insert(0, tsmiTemp);


                //menuStrip1.Items.Add(mItem);
                //toolStripM.Items.Add(tsbMain); //菜单主项按钮添加到主toolstrip
                XmlNodeList mChildNodes = mNode.ChildNodes;
                for (int j = 0; j < mChildNodes.Count; j++)
                {
                    XmlNode mChildNode     = mChildNodes[j];
                    Image   imageChildTemp = null;
                    string  strChildText   = "缺省值";
                    string  strChildName;

                    if (mChildNode.Attributes["imagePath"].Value != null)
                    {
                        imageChildTemp = Image.FromFile(mChildNode.Attributes["imagePath"].Value);
                    }
                    else
                    {
                        imageChildTemp = Image.FromFile(@"Images\1.png");
                    }
                    if (mChildNode.Attributes["text"].Value != null)
                    {
                        strChildText = mChildNode.Attributes["text"].Value;
                    }
                    if (mChildNode.Attributes["name"].Value != null)
                    {
                        strChildName = mChildNode.Attributes["name"].Value;
                    }
                    else
                    {
                        strChildName = new Guid().ToString();
                    }

                    ToolStripButton tsbTemp  = new ToolStripButton(strChildText, imageChildTemp, new EventHandler(t2toolStripButton1_Click), strChildName);//新建业务按钮
                    ModuleList      myModule = new ModuleList();
                    tsbTemp.ImageScaling      = ToolStripItemImageScaling.SizeToFit;
                    tsbTemp.DisplayStyle      = ToolStripItemDisplayStyle.ImageAndText;
                    tsbTemp.TextImageRelation = TextImageRelation.ImageAboveText;
                    myModule.MKHSM            = mChildNode.Attributes["class"].Value;   //获取类名
                    myModule.MKWJM            = mChildNode.Attributes["dllName"].Value; //获取程序集名称
                    tsbTemp.Tag = myModule;
                    myModuleList.Add(myModule);

                    tsTemp.Items.Add(tsbTemp); //业务按钮添加到控件上

                    //添加菜单子项
                    ToolStripMenuItem tsmiSubTemp = new ToolStripMenuItem(strChildText, imageChildTemp, new EventHandler(t2toolStripButton1_Click));
                    tsmiSubTemp.Tag = myModule;

                    tsmiTemp.DropDownItems.Add(tsmiSubTemp);
                }
            }
        }
示例#14
0
        private void tsbRYAdd_Click(object sender, EventArgs e)
        {
            TrimTextBox();
            if (TBGH.Text.Trim() == string.Empty)
            {
                toolTip1.Show("工号不能为空", TBGH, 0, TBGH.Height, 2000);
                return;
            }
            if (TBXM.Text.Trim() == string.Empty)
            {
                toolTip1.Show("姓名不能为空", TBXM, 0, TBXM.Height, 2000);
                return;
            }
            if (Utils.StrToIntDef(TBGH.Text, -1) == -1)
            {
                Dlg.ShowErrorInfoAndHelp("请输入四位数字工号,且不能与已有工号重复!");
                TBGH.SelectAll();
                TBGH.Focus();
                return;
            }
            if (TBDH.Text != "")
            {
                if (Utils.StrToIntDef(TBDH.Text, -1) == -1)
                {
                    Dlg.ShowErrorInfoAndHelp("请输入正确的电话号码数字!");
                    TBDH.SelectAll();
                    TBDH.Focus();
                    return;
                }
            }

            ry ry = new ry();

            ry.GH  = Convert.ToInt32(TBGH.Text);
            ry.XM  = TBXM.Text.Trim();
            ry.XB  = "男";
            ry.DH  = TBDH.Text.Trim();
            ry.SH  = Convert.ToInt32(CBoxSH.SelectedValue);
            ry.RYZ = Convert.ToInt32(CBoxRole.SelectedValue);
            if (rbFemale.Checked == true)
            {
                ry.XB = "女";
            }
            int ret = Convert.ToInt32(SqlHelper.ExecuteScalar(string.Format("select count(1) from ptry where gh='{0}'", ry.GH)));

            if (ret > 0)
            {
                toolTip1.Show("该工号已存在,请重新输入", TBGH, 0, TBGH.Height, 2000);
                TBGH.Focus();
                return;
            }

            string mSql = string.Format("insert into ptry(gh,xm,xb,dh,sh,jb,zt,mm) values ({0},'{1}','{2}','{3}',{4},{5},'0','{6}')", ry.GH, ry.XM, ry.XB, ry.DH, ry.SH, ry.RYZ, MD5.Md5Encrypt("1001"));

            ret = SqlHelper.ExecuteNonQuery(mSql);
            if (ret > 0)
            {
                InitRY();
                SelectRow(ry.GH);
                Dlg.ShowOKInfo("添加成功,初始密码1001!");
            }
        }
示例#15
0
 /// <summary>
 /// Fires off your delegate asyncronously, using the threadpool or a full managed thread if needed.
 /// </summary>
 /// <param name="d">A void delegate - can be cast to (Dlg) from an anonymous delgate or method:  Async.Do((Dlg)MyVoidMethod);</param>
 /// <param name="rMode">If true, will make sure no other instances are running your method.</param>
 /// <returns>AsyncRes with all kind o' goodies for waiting, result values, etc.</returns>
 public static AsyncRes Do(Dlg d, ReenteranceMode rMode)
 {
     return Do(null, d, false, null, true, rMode, null, true);
 }
示例#16
0
文件: ManageMenu.cs 项目: zymITsky/ss
        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            ModuleList ml = new ModuleList();

            ml.MKBH     = txtMKBH.Text.Trim();
            ml.MKMC     = txtMKMC.Text.Trim();
            ml.MKTP     = cmbTP.Text;
            ml.BBH      = txtBBH.Text.Trim();
            ml.CardType = Convert.ToInt32(cmbCardType.SelectedValue);

            if (ml.MKBH == "")
            {
                toolTip1.Show("模块编号不能为空!", txtMKBH, 0, txtMKBH.Height, 2000);
                return;
            }
            if (ml.MKMC == "")
            {
                toolTip1.Show("模块名称不能为空!", txtMKMC, 0, txtMKMC.Height, 2000);
                return;
            }
            if (ml.BBH == "")
            {
                toolTip1.Show("模块版本号不能为空!", txtBBH, 0, txtBBH.Height, 2000);
                return;
            }

            int    ret;
            string mSql;

            ret = Convert.ToInt32(SqlHelper.ExecuteScalar(string.Format("select count(1) from ptcd where mkbh='{0}'", ml.MKBH)));
            if (ret > 0)
            {
                toolTip1.Show("该模块编号已存在!", txtMKBH, 0, txtMKBH.Height, 2000);
                return;
            }
            if (rbZCD.Checked == true)
            {
                ml.MKJB      = 1;
                ml.MKFCD     = "0000";
                ml.MKWJM     = "";
                ml.MKHSM     = "";
                ml.FastStart = "0";
                mSql         = string.Format("insert into ptcd(mkbh,mkmc,mkjb,mkfcd,mktp,bbh,cardtype) values('{0}','{1}','{2}','{3}','{4}','{5}',{6})", ml.MKBH, ml.MKMC, ml.MKJB, ml.MKFCD, ml.MKTP, ml.BBH, ml.CardType);
            }
            else
            {
                if (ml.MKWJM == "")
                {
                    toolTip1.Show("模块文件名不能为空!", txtMKWJM, 0, txtMKWJM.Height, 2000);
                    return;
                }
                if (ml.MKHSM == "")
                {
                    toolTip1.Show("模块函数名不能为空!", txtMKWJM, 0, txtMKWJM.Height, 2000);
                    return;
                }
                if (cmbFCD.SelectedIndex == -1)
                {
                    toolTip1.Show("请选择父菜单!", cmbFCD, 0, cmbFCD.Height, 2000);
                    return;
                }
                ml.FastStart = Convert.ToInt32(cbFastStart.Checked).ToString();
                ml.MKJB      = 2;
                ml.MKFCD     = cmbFCD.SelectedValue.ToString();
                ml.MKWJM     = txtMKWJM.Text.Trim();
                ml.MKHSM     = txtMKHSM.Text.Trim();
                mSql         = string.Format("insert into ptcd(mkbh,mkmc,mkjb,mkfcd,mktp,mkwjm,mkhsm,faststart,bbh,cardtype) values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}',{9})", ml.MKBH, ml.MKMC, ml.MKJB, ml.MKFCD, ml.MKTP, ml.MKWJM, ml.MKHSM, ml.FastStart, ml.BBH, ml.CardType);
            }
            ret = SqlHelper.ExecuteNonQuery(mSql);
            if (ret > 0)
            {
                InitRight();
                Dlg.ShowOKInfo("创建成功");
            }
        }
示例#17
0
 public void OnCancel()
 {
     Dlg.Call(ref this._actOnCancel);
     base.get_transform().localScaleZero();
 }
示例#18
0
 /// <summary>
 /// Fires off your delegate asyncronously, using the threadpool or a full managed thread if needed.
 /// </summary>
 /// <param name="d">A void delegate - can be cast to (Dlg) from an anonymous delgate or method:  Async.Do((Dlg)MyVoidMethod);</param>
 /// <param name="state">A user object that can be tracked through the returned result</param>
 /// <param name="tryThreadPool">True to use the TP, otherwise just go to a ful lthread - good for long running tasks.</param>
 /// <param name="rMode">If true, will make sure no other instances are running your method.</param>
 /// <returns>AsyncRes with all kind o' goodies for waiting, result values, etc.</returns>
 public static AsyncRes Do(Dlg d, object state, bool tryThreadPool, ReenteranceMode rMode)
 {
     return Do(null, d, false, state, tryThreadPool, rMode, null, true);
 }
 private void OnFinished()
 {
     Dlg.Call(ref _actOnFinished);
 }
示例#20
0
 /// <summary>
 /// Fires off your delegate, carefully using the correct UI thread
 /// </summary>
 /// <param name="d">A void delegate - can be cast to (Dlg) from an anonymous delgate or method:  Async.Do((Dlg)MyVoidMethod);</param>
 /// <param name="async">Whether to run async, or try on current thread if invoke is not required.</param>
 /// <param name="c">A control to Invoke upon GUI thread of, if needed. Null if unused.</param>
 /// <returns>AsyncRes with all kind o' goodies for waiting, result values, etc.</returns>
 public static AsyncRes UI(Dlg d, Control c, bool async)
 {
     return Do(null, d, false, null, false, ReenteranceMode.Allow, c, async);
 }
示例#21
0
        private void tsbRYSave_Click(object sender, EventArgs e)
        {
            if (dgvRY.SelectedRows.Count < 1)
            {
                Dlg.ShowErrorInfoAndHelp("请先选择要保存的用户");
                return;
            }
            if (TBGH.Text.Trim() == string.Empty)
            {
                toolTip1.Show("工号不能为空", TBGH, 0, TBGH.Height, 2000);
                return;
            }
            if (TBXM.Text.Trim() == string.Empty)
            {
                toolTip1.Show("姓名不能为空", TBXM, 0, TBXM.Height, 2000);
                return;
            }
            ry ry = new ry();

            ry.GH  = Convert.ToInt32(TBGH.Text);
            ry.XM  = TBXM.Text.Trim();
            ry.XB  = "男";
            ry.DH  = TBDH.Text.Trim();
            ry.SH  = Convert.ToInt32(CBoxSH.SelectedValue);
            ry.RYZ = Convert.ToInt32(CBoxRole.SelectedValue);
            if (rbFemale.Checked == true)
            {
                ry.XB = "女";
            }
            int gh = Convert.ToInt32(dgvRY.SelectedRows[0].Cells["ColGH"].Value);
            int ret;

            if (gh != ry.GH)
            {
                Dlg.ShowErrorInfoAndHelp("已经创建的员工不允许修改其工号!");
                return;
                //if (gh == 1001)
                //{
                //    Dlg.ShowErrorInfoAndHelp("员工1001不允许修改工号!");
                //    return;
                //}
                //ret = Convert.ToInt32(SqlHelper.ExecuteScalar(string.Format("select count(1) from ptry where gh={0}", ry.GH)));
                //if (ret > 0)
                //{
                //    toolTip1.Show("该工号已存在,请重新输入", TBGH, 0, TBGH.Height, 2000);
                //    TBGH.Focus();
                //    return;
                //}
            }
            if ((gh == 1001) && (ry.RYZ != (int)dgvRY.SelectedRows[0].Cells["ColJB"].Value))
            {
                Dlg.ShowErrorInfoAndHelp("员工1001不允许修改权限!");
                return;
            }
            string mSql = string.Format("update ptry set gh='{0}',xm='{1}',xb='{2}',dh='{3}',sh={4},jb={5} where gh='{6}'", ry.GH, ry.XM, ry.XB, ry.DH, ry.SH, ry.RYZ, gh);

            ret = SqlHelper.ExecuteNonQuery(mSql);
            if (ret > 0)
            {
                InitRY();
                SelectRow(ry.GH);
                Dlg.ShowOKInfo("修改成功!");
            }
        }
示例#22
0
        /// <summary>
        /// Fires off your delegate asyncronously, using the threadpool or a full managed thread if needed.
        /// </summary>
        /// <param name="d">A void delegate - can be cast to (Dlg) from an anonymous delgate.</param>
        /// <param name="dr">A delegate with a return value of some sort - can be cast to (DlgR) from an anonymous delgate with a return.</param>
        /// <param name="state">A user object that can be tracked through the returned result</param>
        /// <param name="getRetVal">If true, and the method/delgete returns something, it is included in the AsyncRes returned (after the method completes)</param>
        /// <param name="tryThreadPool">True to use the TP, otherwise just go to a ful lthread - good for long running tasks.</param>
        /// <param name="rMode">If true, will make sure no other instances are running your method.</param>
        /// <returns>AsyncRes with all kind o' goodies for waiting, result values, etc.</returns>
        private static AsyncRes Do(DlgR dr, Dlg d, bool getRetVal, object state, bool tryThreadPool, ReenteranceMode rMode, Control control, bool async)
        {
            //get a generic MethodInfo for checks..
            MethodInfo mi = ((dr != null) ? dr.Method : d.Method);
            //make a unique key for output usage
            string key = string.Format("{0}{1}{2}{3}", ((getRetVal) ? "<-" : ""), mi.DeclaringType, ((mi.IsStatic) ? ":" : "."), mi.Name);
            //our custom return value, holds our delegate, state, key, etc.
            AsyncRes res = new AsyncRes(state, ((dr != null) ? (Delegate)dr : (Delegate)d), key, rMode);

            //Create a delegate wrapper for what we will actually invoke..
            Dlg dlg = (Dlg)delegate {
                if (!BeforeInvoke(res)) return; //checks for reentrance issues and sets us up
                try {
                    if (res.IsCompleted) return;
                    if (dr != null) {
                        res.retVal = dr();//use this one if theres a return
                    } else {
                        d();//otherwise the simpler dlg
                    }
                } catch (Exception ex) { //we never want a rogue exception on a random thread, it can't bubble up anywhere
                    GSharp.Logging.Log.Exception("Error during async Invoke", ex);
                } finally {
                    FinishInvoke(res);//this will fire our callback if they used it, and clean up
                }
            };

            if (control != null) {
                try {
                    res.control = control;
                    res.result = AsyncAction.ControlInvoked;
                    if (!async) {
                        if (!control.InvokeRequired) {
                            res.completedSynchronously = true;
                            dlg();
                        } else {
                            control.Invoke(dlg);
                        }
                    } else {
                        control.BeginInvoke(dlg);
                    }
                } catch (Exception ex) {
                    GSharp.Logging.Log.Exception("Error during async Invoke", ex);
                }
                return res;
            } //don't catch these errors - if this fails, we shouldn't try a real thread or threadpool!

            if (tryThreadPool) { //we are going to use the .NET threadpool
                try {
                    //get some stats - much better than trying and silently failing or throwing an expensive exception
                    int minThreads, minIO, threads, ioThreads, totalThreads, totalIO;
                    ThreadPool.GetMinThreads(out minThreads, out minIO);
                    ThreadPool.GetAvailableThreads(out threads, out ioThreads);
                    ThreadPool.GetMaxThreads(out totalThreads, out totalIO);

                    //check for at least our thread plus one more in ThreadPool
                    if (threads > minThreads) {
                        //this is what actually fires this task off..
                        bool result = ThreadPool.QueueUserWorkItem((WaitCallback)delegate { dlg(); });
                        if (result) {
                            res.result = AsyncAction.ThreadPool;
                            //this means success in queueing and running the item
                            return res;
                        } else {
                            //according to docs, this "won't ever happen" - exception instead, but just for kicks.
                            GSharp.Logging.Log.Error("Failed to queue in threadpool. Method: " + key);
                        }
                    } else {
                        GSharp.Logging.Log.Error(String.Format("Insufficient idle threadpool threads: {0} of {1} - min {2}, Method: {3}", threads, totalThreads, minThreads, key));
                    }
                } catch (Exception ex) {
                    GSharp.Logging.Log.Exception("Failed to queue in threadpool: " + ex.Message + " Method: " + key, ex);
                }
            }

            //if we got this far, then something up there failed, or they wanted a dedicated thread
            Thread t = new Thread((ThreadStart)delegate { dlg(); });
            t.IsBackground = true; //this or threadpriority are candidates for additional settings
            t.Name = "Async_" + key;
            res.result = AsyncAction.Thread;
            t.Start();

            return res;
        }
示例#23
0
        private object addControl(string senderName, ModuleList mModule)
        {
            try
            {
                Control mCT = null;

                string sCtrlName = mModule.MKHSM;
                if (PnlClient.Controls.Find(sCtrlName, false).Length > 0) //该页面已存在
                {
                    mCT = PnlClient.Controls.Find(sCtrlName, false)[0];
                }
                else
                {
                    Assembly myAs;

                    string sDllFile = mModule.MKWJM;
                    if (File.Exists(sDllFile))
                    {
                        myAs = Assembly.LoadFrom(sDllFile);
                    }
                    else
                    {
                        myAs = Assembly.GetExecutingAssembly();
                    }
                    if (myAs == null)
                    {
                        Dlg.ShowErrorInfoAndHelp(string.Format("未找到程序集({0})", mModule.MKWJM));
                        return(null);
                    }

                    Type mType = myAs.GetType(sCtrlName);
                    if (mType == null)
                    {
                        Dlg.ShowErrorInfoAndHelp(string.Format("没有找到窗体({0})!", sCtrlName));
                        return(1);
                    }
                    mCT      = (Control)Activator.CreateInstance(mType);
                    mCT.Name = sCtrlName;
                    //if (mType.BaseType.Name != "Form" )
                    //{
                    //    mCT.BackColor = System.Drawing.Color.Transparent;
                    //}
                    SetDoubleBuffered(mCT);
                    //SetBackColorTransParent(mCT);
                    mCT.Dock = System.Windows.Forms.DockStyle.Fill;

                    if (mCT is Form)
                    {
                        mCT.Show();
                    }
                    else
                    {
                        mCT.Tag = mModule;
                        //PnlClient.Controls.Clear();
                        foreach (Control ctrl in PnlClient.Controls)
                        {
                            ctrl.Dispose();
                        }
                        PnlClient.Controls.Add(mCT);
                    }
                    // mCT.Parent = panel1;
                }

                if (mCT != null)
                {
                    //for (int i = 0; i < panel1.Controls.Count; i++)
                    //{
                    //    panel1.Controls[i].Dispose();
                    //}
                    mCT.BringToFront();
                    mCT.Select();
                }
                LblTip.Text = senderName;
            }
            catch (Exception ex)
            {
                Dlg.ShowErrorInfo(string.Format("异常:\n{0}", ex.Message));
                return(1);
            }
            return(0);  //0成功
        }
示例#24
0
 /// <summary>
 /// Fires off your delegate asyncronously, using the threadpool or a full managed thread if needed. 
 /// This overload always tries the ThreadPool and DOES NOT check for reentrance.
 /// </summary>
 /// <param name="d">A void delegate - can be cast to (Dlg) from an anonymous delgate or method:  Async.Do((Dlg)MyVoidMethod)</param>
 /// <returns>AsyncRes with all kind o' goodies for waiting, etc.</returns>
 public static AsyncRes Do(Dlg d)
 {
     return Do(d, ReenteranceMode.Allow);
 }
示例#25
0
 public virtual void OnCancel()
 {
     Dlg.Call(ref _actOnCancel);
 }
示例#26
0
 /// <summary>
 /// Fires off your delegate asyncronously, using the threadpool or a full managed thread if needed.
 /// This overload always tries the ThreadPool and DOES NOT check for reentrance.
 /// </summary>
 /// <param name="d">A void delegate - can be cast to (Dlg) from an anonymous delgate or method:  Async.Do((Dlg)MyVoidMethod)</param>
 /// <returns>AsyncRes with all kind o' goodies for waiting, etc.</returns>
 public static AsyncRes Do(Dlg d)
 {
     return(Do(d, ReenteranceMode.Allow));
 }
示例#27
0
 private void taskm_Canceled(object sender, TaskCanceledEventArgs e)
 {
     logger.Log(string.Format(Resources.ReadStoped, GetMemoryType()), Category.Debug, Priority.None);
     Dlg.Result = false;
     Dlg.Close();
 }
示例#28
0
        /// <summary>
        /// Fires off your delegate asyncronously, using the threadpool or a full managed thread if needed.
        /// </summary>
        /// <param name="d">A void delegate - can be cast to (Dlg) from an anonymous delgate or method:  Async.Do((Dlg)MyVoidMethod);</param>

        /// <param name="rMode">If true, will make sure no other instances are running your method.</param>
        /// <returns>AsyncRes with all kind o' goodies for waiting, result values, etc.</returns>
        public static AsyncRes Do(Dlg d, ReenteranceMode rMode)
        {
            return(Do(null, d, false, null, true, rMode));
        }
示例#29
0
 private void taskm_Canceled(object sender, TaskCanceledEventArgs e)
 {
     logger.Log(Resources.ResetStoped, Category.Debug, Priority.None);
     Dlg.Result = false;
     Dlg.Close();
 }
示例#30
0
 /// <summary>
 /// Fires off your delegate asyncronously, using the threadpool or a full managed thread if needed.
 /// </summary>
 /// <param name="d">A void delegate - can be cast to (Dlg) from an anonymous delgate or method:  Async.Do((Dlg)MyVoidMethod);</param>
 /// <param name="state">A user object that can be tracked through the returned result</param>
 /// <param name="tryThreadPool">True to use the TP, otherwise just go to a ful lthread - good for long running tasks.</param>
 /// <param name="rMode">If true, will make sure no other instances are running your method.</param>
 /// <returns>AsyncRes with all kind o' goodies for waiting, result values, etc.</returns>
 public static AsyncRes Do(Dlg d, object state, bool tryThreadPool, ReenteranceMode rMode)
 {
     return(Do(null, d, false, state, tryThreadPool, rMode));
 }
示例#31
0
 private void PlayLookAtLine2Assult()
 {
     Dlg.Call(ref _actOnPlayLookAtLine2Assult);
 }
示例#32
0
 protected virtual void OnClose()
 {
     Dlg.Result = false;
     Dlg.Close();
 }
示例#33
0
文件: ManageMenu.cs 项目: zymITsky/ss
        private void tsbModify_Click(object sender, EventArgs e)
        {
            string MKBH;

            if (tvRight.SelectedNode == null)
            {
                Dlg.ShowErrorInfoAndHelp("请选择要修改的模块!");
                return;
            }
            MKBH = ((ModuleList)tvRight.SelectedNode.Tag).MKBH;
            ModuleList ml = new ModuleList();

            ml.MKBH = txtMKBH.Text.Trim();
            ml.MKMC = txtMKMC.Text.Trim();
            ml.MKTP = cmbTP.Text;
            ml.BBH  = txtBBH.Text.Trim();

            ml.CardType = Convert.ToInt32(cmbCardType.SelectedValue);

            if (ml.MKBH == "")
            {
                toolTip1.Show("模块编号不能为空!", txtMKBH, 0, txtMKBH.Height, 2000);
                return;
            }
            if (ml.MKMC == "")
            {
                toolTip1.Show("模块名称不能为空!", txtMKMC, 0, txtMKMC.Height, 2000);
                return;
            }
            if (ml.BBH == "")
            {
                toolTip1.Show("模块版本号不能为空!", txtBBH, 0, txtBBH.Height, 2000);
                return;
            }

            int           ret;
            string        mSql;
            List <string> mSqls = new List <string>();

            if (MKBH != ml.MKBH)
            {
                ret = Convert.ToInt32(SqlHelper.ExecuteScalar(string.Format("select count(1) from ptcd where mkbh='{0}'", ml.MKBH)));
                if (ret > 0)
                {
                    toolTip1.Show("该模块编号已存在!", txtMKBH, 0, txtMKBH.Height, 2000);
                    return;
                }
            }
            if (rbZCD.Checked == true)
            {
                ml.MKWJM     = "";
                ml.MKHSM     = "";
                ml.MKJB      = 1;
                ml.MKFCD     = "0000";
                ml.FastStart = "0";
            }
            else
            {
                if (ml.MKWJM == "")
                {
                    toolTip1.Show("模块文件名不能为空!", txtMKWJM, 0, txtMKWJM.Height, 2000);
                    return;
                }
                if (ml.MKHSM == "")
                {
                    toolTip1.Show("模块函数名不能为空!", txtMKWJM, 0, txtMKWJM.Height, 2000);
                    return;
                }
                ml.FastStart = Convert.ToInt32(cbFastStart.Checked).ToString();
                ml.MKJB      = 2;
                ml.MKFCD     = cmbFCD.SelectedValue.ToString();
                ml.MKWJM     = txtMKWJM.Text.Trim();
                ml.MKHSM     = txtMKHSM.Text.Trim();
            }
            mSql = string.Format("update ptcd set mkbh='{0}',mkmc='{1}',mkjb='{2}',mkfcd='{3}',mktp='{4}',mkwjm='{5}',mkhsm='{6}',faststart='{7}',bbh='{8}',cardtype={9} where mkbh='{10}'", ml.MKBH, ml.MKMC, ml.MKJB, ml.MKFCD, ml.MKTP, ml.MKWJM, ml.MKHSM, ml.FastStart, ml.BBH, ml.CardType, MKBH);
            mSqls.Add(mSql);
            mSql = string.Format("update ptcd set mkfcd ='{0}' where mkfcd='{1}'", ml.MKBH, MKBH);
            mSqls.Add(mSql);
            ret = SqlHelper.ExecuteSqls(mSqls.ToArray());
            if (ret == 0)
            {
                InitRight();
                //tvRight.BeginUpdate();
                //try
                //{
                //    TreeNode[] mNodes = tvRight.Nodes.Find(ml.MKBH, true);
                //    if (mNodes.Length > 0)
                //        tvRight.SelectedNode = mNodes[0];
                //}
                //finally
                //{
                //    tvRight.EndUpdate();
                //}
                Dlg.ShowOKInfo("修改成功!");
            }
        }
示例#34
0
 protected virtual void OnOk()
 {
     Dlg.Result = true;
     Dlg.Close();
 }
        /// <summary>
        /// 刷新查询数据
        /// </summary>
        private void refresh()
        {
            string mSql = @"select ms.Id,ms.datadate,un.username userid,cn.companyname customerid,ms.cardid,ca.cardname cardname,ca.cardbalance,edu.ed,ms.mealmoney,ms.recdate,ms.status,an.username auditid,ms.auditdate,p.DepartmentName,P.username IntUsedID from t_meals ms
left join t_users un on ms.userid = un.id
left join t_customers cn on ms.customerid = cn.id
left join t_cards ca on ms.cardid = ca.id
left join t_users [an] on ms.operid = an.id
left join t_users P on ms.IntUsedID = P.id
left join (select isnull(ss.salesum,0) - isnull(gs.GiftSum,0)-isnull(ms.mealsum,0) ed,a.id from t_users a
left join
(select sum(summoney)/200 salesum ,username from T_Saledetails where saledate between (convert(varchar(4),getdate(),120) + '-01-01') and (convert(varchar(4),getdate(),120) + '-12-31') group by username) ss on a.id = ss.username
left join
(select sum(GiftSum) giftsum,IntUsedID from t_GiftStockOut where datadate between (convert(varchar(4),getdate(),120) + '-01-01') and (convert(varchar(4),getdate(),120) + '-12-31') and status not in('已删除','审核未通过','已提交等待领导审核') group by IntUsedID) gs on a.id = gs.IntUsedID
left join 
(select sum(mealmoney) mealsum,IntUsedID from t_meals where  datadate between (convert(varchar(4),getdate(),120) + '-01-01') and (convert(varchar(4),getdate(),120) + '-12-31') and status not in('已删除','已提交等待领导审核') group by IntUsedID) ms on a.id = ms.IntUsedID
) edu on ms.IntUsedID = edu.id
where ms.status <> '已删除' {0} {1} {2} {3} {4} {5}";//
            string mC1 = "", mC2 = "", mC3 = "", mC4 = "", sDept = "", sUsedEmp = "";

            if (cmbUserName.Text != string.Empty)
            {
                mC1 = "and un.username like '%" + cmbUserName.Text + "%'";
            }
            if (CBoxUsed.Text != string.Empty)
            {
                sUsedEmp = "and P.username like '%" + CBoxUsed.Text + "%'";
            }
            if (cmbCustomers.Text != string.Empty)
            {
                mC2 = "and cn.companyname like '%" + cmbCustomers.Text + "%'";
            }
            if (cmbCards.Text != string.Empty)
            {
                mC3 = "and ca.cardname like '%" + cmbCards.Text + "%'";
            }
            if (cmbHasAudit.Text != string.Empty)
            {
                //dgvExAllocation.Columns["ColumnChecked"].Visible = false;
                if (cmbHasAudit.Text == "未审核")
                {
                    mC4 = "and ms.status='已提交等待领导审核'";
                    //dgvExAllocation.Columns["ColumnChecked"].Visible = true;
                }
                else if (cmbHasAudit.Text == "审核未通过")
                {
                    mC4 = "and ms.status='" + cmbHasAudit.Text + "'";
                }
                else //已通过
                {
                    mC4 = "and ms.status not in('审核未通过','已提交等待领导审核')";
                }
            }
            if (CBoxDept.Text != string.Empty)
            {
                sDept = "and P.DepartmentName like '%" + CBoxDept.Text + "%'";
            }
            mSql = string.Format(mSql, mC1, mC2, mC3, mC4, sDept, sUsedEmp);

            var mTable = SqlHelper.GetData(mSql);

            dgvExAllocation.DataSource = mTable;
            if (mTable.Rows.Count < 1)
            {
                Dlg.ShowOKInfo("没有记录");
                return;
            }
        }
示例#36
0
 private void OnTouch()
 {
     Dlg.Call(ref this._actOnTouch);
 }