public QueryDataViewModel() { if (this.IsInDesignMode) { return; } SelectMeasureCommand = new ActionCommand(SelectMethod); QueryCommand = new ActionCommand(QueryWeightRecords); SupplementCommand = new ActionCommand(SupplementMethod); ShowPictureCommand = new ActionCommand(ShowPictureMethod); ShowVideoCommand = new ActionCommand(ShowVideoMethod); #region 获取配置文件路径 string basePath = System.IO.Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "ClientConfig"); var configPath = System.IO.Path.Combine(basePath, "SystemConfig.xml"); #endregion #region 获取等待任务结果过时时间 int waitPrintResultTime = 1; string waitPrintResultTimeItem = ConfigurationManager.AppSettings["WaitPrintResultTime"].ToString(); string getWaitPrintResultTimeItem = XpathHelper.GetValue(configPath, waitPrintResultTimeItem); if (!string.IsNullOrEmpty(getWaitPrintResultTimeItem)) { waitPrintResultTime = Convert.ToInt32(getWaitPrintResultTimeItem); } #endregion #region 注册等待打印结果计时器 waitPrintReusltTimer = new Calculagraph(""); waitPrintReusltTimer.Timeout = waitPrintResultTime; waitPrintReusltTimer.TimeOver += new TimeoutCaller(waitPrintReusltTimer_TimeOver); #endregion }
/// <summary> /// 创建定时器 /// </summary> /// <param name="timeSize">时间</param> /// <param name="memberIndex">玩家在成员列表中的下标</param> /// <param name="delegateFuc">委托方法(计时器到点执行的函数)</param> public static GameObject CreatTimer(int timeSize, TimerMethodDelegate delegateFuc, Transform transform, Vector3 pos) { //问题有时候会同时出现多个计时器 ---根据保存返回的对象是否为空来控制局部单例计时器 GameObject timerPrefbs = (GameObject)Resources.Load("Prefabs/game/Timer");//卡牌(背面)预制件加载 GameObject timer = Instantiate(timerPrefbs, transform); timer.transform.localPosition = pos; Calculagraph calculagraph = timer.AddComponent <Calculagraph>(); if (delegateFuc != null) { calculagraph.methodDelegate += delegateFuc;//new TimerMethodDelegate(delegateFuc);//创建委托实例 } calculagraph.time = timeSize; //Debug.Log("创建定时器"); return(timer); }