Beispiel #1
0
 private void CheckLock(object o)
 {
     lock (this)
     {
         try
         {
             int num = BugsBox.Pharmacy.MonitorHandlers.Drug.LockCount();
             if (num > 0)
             {
                 NotificationController.DrugLock(num);
             }
             num = BugsBox.Pharmacy.MonitorHandlers.Drug.GetDrugInfoForOutofStockNumber();
             if (num > 0)
             {
                 NotificationController.DrugOutofStock(num);
             }
             IsCheckLockOver = true;
             CallBackDelegate cbd = o as CallBackDelegate;
             cbd();
         }
         catch (Exception ex)
         {
             IsCheckLockOver = true;
             LoggerHelper.Instance.Error(ex);
         }
     }
 }
Beispiel #2
0
        private void Update(object o)
        {
            lock (this)
            {
                try
                {
                    DateTime thisTime = DateTime.Now;

                    BugsBox.Pharmacy.MonitorHandlers.DrugMaintain.CreateMaintainRecord();
                    BugsBox.Pharmacy.MonitorHandlers.DrugMaintain.CreateDrugMantainImpt();
                    BugsBox.Pharmacy.MonitorHandlers.DrugMaintain.CreateDrugMantainInst();
                    BugsBox.Pharmacy.MonitorHandlers.DrugMaintain.CreateDrugMantainZYYP();
                    BugsBox.Pharmacy.MonitorHandlers.DrugMaintain.CreateDrugMantainZYC();
                    BugsBox.Pharmacy.MonitorHandlers.DrugMaintain.SetDrugInventoryRecordOutValid();

                    IsUpdateOver = true;
                    CallBackDelegate cbd = o as CallBackDelegate;
                    cbd();
                }
                catch (Exception ex)
                {
                    LoggerHelper.Instance.Error(ex);
                    IsUpdateOver = true;
                }
            }
        }
Beispiel #3
0
 private void button2_Click(object sender, EventArgs e)
 {
     strOperateStatus = "2";
     strUrl           = this.txtAddress.Text.Trim();
     if (this.strUrl == "")
     {
         MessageBox.Show("请选择文件夹路径!");
     }
     else
     {
         if (rbSimplified.Checked)
         {
             this.strChangeType = "SimplifiedChinese";
         }
         else if (this.rbTraditional.Checked)
         {
             this.strChangeType = "TraditionalChinese";
         }
         else
         {
             MessageBox.Show("请选择转换类型!");
             return;
         }
         CallBackDelegate cbd = new CallBackDelegate(this.CallBack);
         new Thread(new ParameterizedThreadStart(this.ThreadFun)).Start(cbd);
     }
 }
Beispiel #4
0
        bool isRec          = true; //是否循环接收服务端数据
        // Dictionary<string, ConnectionClient> dictConn = new Dictionary<string, ConnectionClient>();
        private void btnConnect_Click(object sender, EventArgs e)
        {
            //实例化 套接字
            sokClient = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
            //创建 ip对象
            IPAddress address = IPAddress.Parse(txtIP.Text.Trim());
            //MessageBox.Show("address");
            //创建网络节点对象 包含 ip和port
            IPEndPoint endpoint = new IPEndPoint(address, int.Parse(txtPort.Text.Trim()));

            //连接 服务端监听套接字
            sokClient.Connect(endpoint);

            //创建负责接收 服务端发送来数据的 线程

            CallBackDelegate cbd = new CallBackDelegate(this.CallBack);

            new Thread(new ParameterizedThreadStart(this.ReceiveMsg)).Start(cbd);

            //threadClient = new Thread(ReceiveMsg);
            //threadClient.IsBackground = true;
            ////如果在win7下要通过 某个线程 来调用 文件选择框的代码,就需要设置如下
            //threadClient.SetApartmentState(ApartmentState.STA);
            //threadClient.Start();
        }
Beispiel #5
0
        private void ThreadFun(object o)
        {
            CallBackDelegate cbd = o as CallBackDelegate;

            try
            {
                FileInfo[] ArrUnPostil = new DirectoryInfo(this.strUrl).GetFiles();
                this.SortAsFileNameX(ref ArrUnPostil);
                foreach (FileInfo FileName in ArrUnPostil)
                {
                    iCount += 1;
                    if (FileName.Name.Contains(".doc") || FileName.Name.Contains(".docx"))
                    {
                        cbd(string.Concat(new object[] { DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), " ", FileName, ":", this.OpenDocument(this.strUrl + @"\" + FileName, FileName.Name.ToString()) }));
                    }
                    else
                    {
                        cbd(string.Concat(new object[] { DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), " ", FileName, "不是有效的word文档" }));
                    }
                }
                if (this.strOperateStatus == "2")
                {
                    cbd(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " " + this.SaveDocument(this.strUrl + @"\Total.docx"));
                }
                cbd(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " " + this.strUrl + "中所有word文档操作完成");
            }
            catch (Exception ex)
            {
                cbd("执行异常:" + ex.Message);
            }
        }
Beispiel #6
0
        private void Update(object o)
        {
            lock (this)
            {
                try
                {
                    DateTime thisTime = DateTime.Now;
                    //NotificationController.SayHello(thisTime.ToString());
                    //0点0分
                    //if (thisTime.Hour == 0 && thisTime.Minute == 0)
                    //{
                    new BugsBox.Pharmacy.MonitorHandlers.PurchaseUnit().UpdateValid();
                    //}

                    IsUpdateOver = true;
                    CallBackDelegate cbd = o as CallBackDelegate;
                    cbd();
                }
                catch (Exception ex)
                {
                    IsUpdateOver = true;
                    LoggerHelper.Instance.Error(ex);
                }
            }
        }
Beispiel #7
0
        private void StartLoadTask()
        {
            int taskCount = this.mTask.Count;
            int curCount  = mCurLoadCount;

            if (taskCount > 0)
            {
                if (curCount < mMaxLoadCount)
                {
                    for (int i = taskCount - 1; i >= 0; i--)
                    {
                        if (mTask[i].mLoadCount == 0)
                        {
                            curCount = curCount + mTask[i].StartLoad();

                            if (curCount >= mMaxLoadCount)
                            {
                                mCurLoadCount = curCount;
                                return;
                            }
                        }
                    }
                }
                mCurLoadCount = curCount;
            }
            else
            {
                if (this.mLoadAllFinishCallBack != null)
                {
                    this.mLoadAllFinishCallBack(null, null);
                    //this.mLoadAllFinishCallBack.Call();
                    this.mLoadAllFinishCallBack = null;
                }
            }
        }
Beispiel #8
0
        /// <summary>
        /// Prepare for tweening.
        /// </summary>
        /// <param name="from"></param>
        /// <param name="to"></param>
        /// <param name="durationX"></param>
        /// <param name="durationY"></param>
        /// <param name="durationZ"></param>
        /// <param name="easingX"></param>
        /// <param name="easingY"></param>
        /// <param name="easingZ"></param>
        /// <param name="callback"></param>
        private void StartTween(
            Vector3 from,
            Vector3 to,
            bool resetElapsedTime     = true,
            float durationX           = 1f,
            float durationY           = 1f,
            float durationZ           = 1f,
            TweenDelegate easingX     = null,
            TweenDelegate easingY     = null,
            TweenDelegate easingZ     = null,
            CallBackDelegate callback = null)
        {
            if (tweener != null)
            {
                // Sets The Position From -> To
                tweener.easeFromTo(
                    from,
                    to + mValueOffset,  // add offset to final value.
                    resetElapsedTime,
                    durationX,
                    durationY,
                    durationZ,
                    easingX,
                    easingY,
                    easingZ,
                    mDestinationCallback);

                this.mIsDoneTweening = false;

                this.mContinueTween = false;
            }
        }
 static void PreLoadAssetFunc(Bundle bundle, string objectName, CallBackDelegate <object, object> callBack, string assetBundlePath = "")
 {
     if (bundle != null)
     {
         bundle.PreLoadFunc();
     }
 }
Beispiel #10
0
 public static void performLongTask(CallBackDelegate clientMethod)
 {
     //add code here...
     MessageBox.Show("Long running task");
     System.Threading.Thread.Sleep(3000);
     clientMethod();
 }
Beispiel #11
0
        public static async void DownloadPhoto(string urlString, CallBackDelegate updateProfileImage)
        {
            using (HttpClient client = new HttpClient())
            {
                try
                {
                    HttpResponseMessage response = await client.GetAsync(new Uri(urlString));

                    BitmapImage bitmap = new BitmapImage();

                    if (response != null && response.StatusCode == HttpStatusCode.OK)
                    {
                        using (var stream = await response.Content.ReadAsStreamAsync())
                        {
                            using (var memStream = new MemoryStream())
                            {
                                await stream.CopyToAsync(memStream);

                                memStream.Position = 0;

                                bitmap.SetSource(memStream.AsRandomAccessStream());
                            }
                        }
                        if (bitmap.PixelHeight > 10 && bitmap.PixelWidth > 10)
                        {
                            updateProfileImage(bitmap);
                        }
                    }
                }
                catch (Exception)
                {
                }
            }
        }
        static async public Task Init(CallBackDelegate callBack)
        {
            mCallBackDelegate = callBack;
            await InitSub();

            return;
        }
Beispiel #13
0
        public void LoadAsset(string path, string fileName, CallBackDelegate <object, object> callBack, GetPathFunc getPathFunc, GetDependBundlesFunc getDependenciesFunc, LoadFunc loadAssetFunc, bool externalScene = false)
        {
            string assetBundleName = path + fileName;
            string assetBundlePath = getPathFunc(assetBundleName);
            Bundle bundle          = this.GetBundle(assetBundlePath, true);

            bundle.mExternalScene = externalScene && mIsMobilePlatform;
            if (mBundleLoadTaskList.ContainsKey(bundle))
            {
                mBundleLoadTaskList[bundle].AddParams(fileName, callBack, loadAssetFunc);
                return;
            }
            if (bundle.mLoadCompleted)
            {
                bundle.LoadParams(fileName, callBack, loadAssetFunc);
                return;
            }
            if (mIsMobilePlatform && callBack != null)
            {
                bundle.mPreloadAssetName = fileName;
            }
            Bundle[] dependBundles = this.GetDependBundles(assetBundleName, getPathFunc, getDependenciesFunc);
            bundle.SetDependBundles(dependBundles);
            this.mLoadedBunders[assetBundlePath] = bundle.mBundle;
            LoadTask loadTask = new LoadTask(bundle, dependBundles);

            loadTask.AddParams(fileName, callBack, loadAssetFunc);
            mBundleLoadTaskList[bundle] = loadTask;
            mTask.Insert(0, loadTask);
            //mTask.Add(  loadTask );
            this.StartLoadTask();
        }
Beispiel #14
0
 private void button2_Click(object sender, EventArgs e)
 {
     strOperateStatus = "2";
     strUrl = this.txtAddress.Text.Trim();
     if (this.strUrl == "")
     {
         MessageBox.Show("请选择文件夹路径!");
     }
     else
     {
         if (rbSimplified.Checked)
         {
             this.strChangeType = "SimplifiedChinese";
         }
         else if (this.rbTraditional.Checked)
         {
             this.strChangeType = "TraditionalChinese";
         }
         else
         {
             MessageBox.Show("请选择转换类型!");
             return;
         }
         CallBackDelegate cbd = new CallBackDelegate(this.CallBack);
         new Thread(new ParameterizedThreadStart(this.ThreadFun)).Start(cbd);
     }
 }
        static private async Task LoadManifest()
        {
            string streamingAssetsStr     = "StreamingAssets";
            string assetBundleManifestStr = "AssetBundleManifest";
            WWW    www = new WWW(ResourceURL.GetUrl(streamingAssetsStr));

            await new WaitUntil(() => www.isDone);
            AssetBundle manifestBundle = www.assetBundle;

            mManifest = (AssetBundleManifest)manifestBundle.LoadAsset(assetBundleManifestStr, typeof(AssetBundleManifest));
            manifestBundle.Unload(false);
            www.Dispose();
            //TODO ADD ART WORK SPACE

            WWW www1 = new WWW(ResourceURL.GetExternalUrl(streamingAssetsStr));

            await new WaitUntil(() => www1.isDone);
            AssetBundle manifestBundle1 = www1.assetBundle;

            mExternalManifest = (AssetBundleManifest)manifestBundle1.LoadAsset(assetBundleManifestStr, typeof(AssetBundleManifest));
            manifestBundle1.Unload(false);
            www1.Dispose();
            mCallBackDelegate();
            //  mInitCallback.Call();
            mCallBackDelegate = null;
        }
Beispiel #16
0
 public override void LoadObject(string assetName, CallBackDelegate <object, object> callBack, bool instantiate, int assetType)
 {
     this.mAssetType = assetType;
     if (!this.mAssets.ContainsKey(assetName))
     {
         if (this.mBundle == null)
         {
             Debug.Log("Bundle Null" + assetName);
         }
         this.mAssets[assetName] = this.mBundle.LoadAsset(assetName);
     }
     if (instantiate == true)
     {
         Object assetInstance = Object.Instantiate(this.mAssets[assetName]);
         this.mInstanceReferences[this.mInstanceReferences.Count + 1] = assetInstance;
         // callBack.Call(assetInstance);
         callBack(assetInstance, null);
     }
     else
     {
         Debug.Log("NoInstance");
         callBack(this.mAssets[assetName], null);
         // callBack.Call(this.mAssets[assetName]);
     }
 }
Beispiel #17
0
        private void Do(object o)
        {
            lock (this)
            {
                try
                {
                    List <Business.Models.WarningData> wd = new List <Business.Models.WarningData>();
                    wd.Add(new Business.Models.WarningData()
                    {
                        key   = "销售单审核",
                        value = BugsBox.Pharmacy.MonitorHandlers.Sale.GetNeedCheckOrder()
                    });
                    wd.Add(new Business.Models.WarningData()
                    {
                        key   = "拣货",
                        value = BugsBox.Pharmacy.MonitorHandlers.Sale.GetNeedTake()
                    });

                    wd.Add(new Business.Models.WarningData()
                    {
                        key   = "拣货核查",
                        value = BugsBox.Pharmacy.MonitorHandlers.Sale.GetNeedCheckChuKu()
                    });
                    wd.Add(new Business.Models.WarningData()
                    {
                        key   = "配送",
                        value = BugsBox.Pharmacy.MonitorHandlers.Sale.GetNeedPeiSong()
                    });
                    wd.Add(new Business.Models.WarningData()
                    {
                        key   = "销退销售员审核",
                        value = BugsBox.Pharmacy.MonitorHandlers.Sale.GetNeed_XT_XSY_Check()
                    });
                    wd.Add(new Business.Models.WarningData()
                    {
                        key   = "销退营业部审核",
                        value = BugsBox.Pharmacy.MonitorHandlers.Sale.GetNeed_XT_YYB_Check()
                    });
                    wd.Add(new Business.Models.WarningData()
                    {
                        key   = "销退质管部审核",
                        value = BugsBox.Pharmacy.MonitorHandlers.Sale.GetNeed_XT_ZGB_Check()
                    });

                    if (wd.Where(p => p.value > 0).Count() > 0)
                    {
                        NotificationController.NeedHandleSale(wd.Where(p => p.value > 0).ToArray());
                    }

                    IsDoOver = true;
                    CallBackDelegate cbd = o as CallBackDelegate;
                    cbd();
                }
                catch (Exception ex)
                {
                    LoggerHelper.Instance.Error(ex);
                    IsDoOver = true;
                }
            }
        }
Beispiel #18
0
        private void btn_sendEmail_Click(object sender, EventArgs e)
        {
            ButtonBase btn = (ButtonBase)sender;

            //发送邮件逻辑

            //获取需要发送的邮件
            List <Email> emailList = new List <Email>();

            if (myUtils.existsCache(SysConstant.CACHE_EMAILS))
            {
                emailList = (List <Email>)myUtils.getCache(SysConstant.CACHE_EMAILS);
            }
            else
            {
                MessageBoxEx.Show(this, "没有需要发送的邮件!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (emailList.Count == 00)
            {
                MessageBoxEx.Show(this, "没有需要发送的邮件!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                if (this.threadSendEmail != null && this.threadSendEmail.IsAlive)
                {
                    this.threadSendEmail.Abort();
                    //结束线程后 修改缓存中线程状态
                    myUtils.deleteCache(SysConstant.CACHE_EMAIL_SEBD_STATE);
                }

                this.Dispose();

                return;
            }


            //邮件内容必须在10字以上,要不怕邮件服务器 把邮件给退回

            this.emailTitle = this.tb_emailTitle.Text.Trim();

            this.emailContent = this.tb_emailContent.Text.Trim();
            if (this.emailContent.Length <= 10)
            {
                MessageBoxEx.Show(this, "邮件内容必须大于10个字符!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }


            CallBackDelegate cbd = CallBack;


            //新开一个线程来执行发送邮件工作
            this.threadSendEmail = new Thread(new ParameterizedThreadStart(EmailSender));

            this.threadSendEmail.IsBackground = true;

            this.threadSendEmail.Start(cbd);

            this.Close();
        }
Beispiel #19
0
 public void LongRunning(CallBackDelegate obj)
 {
     for (int i = 0; i < 100; i++)
     {
         // Does something
         obj(i);
     }
 }
Beispiel #20
0
 public GetPathThread(RTSObject objectCalling, Cell currentTile, Vector3 targetTile, int blockingLevel, CallBackDelegate callBackFunction = null)
 {
     m_ObjectCalling    = objectCalling;
     m_CurrentTile      = currentTile;
     m_TargetTile       = targetTile;
     m_BlockingLevel    = blockingLevel;
     m_CallBackFunction = callBackFunction;
 }
Beispiel #21
0
        /// <summary>
        /// 添加需要回调的委托
        /// </summary>
        /// <param name="mType"></param>
        /// <param name="call"></param>
        public void Add(eMonoMessageType mType, CallBackDelegate call)
        {
            CallBackDelegate notity = null;

            notifys.TryGetValue(mType, out notity);
            notity += call;
            notifys.Add(mType, call);
        }
Beispiel #22
0
        static void Main(string[] args)
        {
            CallBackDelegate cbd = CallBack;
            Thread           th  = new Thread(Fun);

            th.Start(cbd);
            Console.ReadLine();
        }
 public GetPathThread(RTSObject objectCalling, Tile currentTile, Tile targetTile, int blockingLevel, CallBackDelegate callBackFunction = null)
 {
     m_ObjectCalling = objectCalling;
     m_CurrentTile = currentTile;
     m_TargetTile = targetTile;
     m_BlockingLevel = blockingLevel;
     m_CallBackFunction = callBackFunction;
 }
Beispiel #24
0
 private static void DoWebClient(string strUri, CallBackDelegate callBack)
 {
     Debug.WriteLine(strUri);
     Uri uri = new Uri(strUri);
     WebClient webClient = new WebClient();
     webClient.OpenReadAsync(uri);//在不阻止调用线程的情况下,从资源返回数据
     webClient.OpenReadCompleted += new OpenReadCompletedEventHandler(callBack);//异步操作完成时发生
 }
Beispiel #25
0
    public async void SetExternal(string path, string file, CallBackDelegate <object, object> mCall, GetDependBundlesFuncDelegate getExternalDependcesFunc)
    {
        string assetName = path + file;

        string[] dependencies = getExternalDependcesFunc(assetName);
        if (this.mAssetsLoaderAsyncDic.ContainsKey("external/" + assetName))
        {
            Debug.Log("await");
            await new WaitUntil(() => mAssetsLoaderAsyncDic.ContainsKey("external/" + assetName) == false && this.resourceCache.ContainsKey("external/" + assetName));
        }
        if (this.resourceCache.ContainsKey("external/" + assetName))
        {
            //  Debug.Log(("external/" + assetName));
            GameObject obj = GameObject.Instantiate((GameObject)this.resourceCache["external/" + assetName]);
            this.bundles["external/" + assetName].AddRefObj(obj);
            // Debug.Log("AddRef" + "external/" + assetName + "Num" + this.bundles["external/" + assetName].RefCount);
            foreach (var v in dependencies)
            {
                if (v != assetName)
                {
                    if (!SyncResourceManager.CheckSyncAssetManagerLoaded("external/" + v))
                    {
                        this.bundles["external/" + v].AddRefObj(obj);
                        //   Debug.Log("AddRef" + "external/" + v + "Num" + this.bundles["external/" + v].RefCount);
                    }
                }
            }
            mCall(obj, file);
            // mLua.Call(obj, file);
        }
        else
        {
            AssetsLoaderAsync assetsLoaderAsync = new AssetsLoaderAsync();
            assetsLoaderAsync.SetBundle(this.bundles["external/" + assetName].AssetBundle, "external/" + assetName);
            mAssetsLoaderAsync.Add(assetsLoaderAsync);
            mAssetsLoaderAsyncDic["external/" + assetName] = assetsLoaderAsync;
            GameObject temp = (GameObject)await assetsLoaderAsync.LoadAssetAsync(file);

            GameObject obj = GameObject.Instantiate(temp);
            this.bundles["external/" + assetName].AddRefObj(obj);
            //   Debug.Log("AddRef" + "external/" + assetName + "Num" + this.bundles["external/" + assetName].RefCount);
            foreach (var v in dependencies)
            {
                if (v != assetName)
                {
                    if (!SyncResourceManager.CheckSyncAssetManagerLoaded("external/" + v))
                    {
                        this.bundles["external/" + v].AddRefObj(obj);
                        //    Debug.Log("AddRef" + "external/" + v + "Num" + this.bundles["external/" + v].RefCount);
                    }
                }
            }
            this.bundles["external/" + assetName].AssetBundle.Unload(false);
            this.resourceCache["external/" + assetName] = temp;
            mCall(obj, file);
            //mLua.Call(obj,file);
        }
    }
Beispiel #26
0
        public void AddParams(string objectName, CallBackDelegate <object, object> callBack, LoadFunc loadObjectFunc = null)
        {
            Params mParams = new Params();

            mParams.objectName     = objectName;
            mParams.callBack       = callBack;
            mParams.loadObjectFunc = loadObjectFunc;
            this.mParamsList.Enqueue(mParams);
        }
Beispiel #27
0
        /// <summary>
        /// Callback when reach destination.
        /// </summary>
        /// <param name="func"> function pointer </param>
        public void SetCallback(CallBackDelegate func)
        {
            if (func == null)
            {
                return;
            }

            this._Callback += func;
        }
Beispiel #28
0
        private void FindServerStart()
        {
            thread   = null;
            m_isStop = false;
            CallBackDelegate cbd = CallBack;

            thread = new Thread(TryConnetServer);
            thread.Start(cbd);
        }
Beispiel #29
0
        public Worker(CallBackDelegate resultCallBack)
        {
            // This time delay represents the action being done
            // In real world application, you will put the code that takes time instead
            Thread.Sleep(5000);

            // Invoking the delegate object which will in turn invoke the method associated with it
            resultCallBack(true);
        }
Beispiel #30
0
        /// <summary>
        /// Eases from value to value.
        /// </summary>
        /// <param name="from">From.</param>
        /// <param name="to">To.</param>
        /// <param name="duration">Duration.</param>
        /// <param name="easing">Easing.</param>
        public void easeFromTo(
            Vector3 from, Vector3 to,
            bool resetElapsedTime     = true,
            float durationX           = 1f,
            float durationY           = 1f,
            float durationZ           = 1f,
            TweenDelegate easingX     = null,
            TweenDelegate easingY     = null,
            TweenDelegate easingZ     = null,
            CallBackDelegate callback = null)
        {
            if (easingX == null)
            {
                // give the default value
                easingX = Easing.Linear;
            }

            if (easingY == null)
            {
                // give the default value
                easingY = Easing.Linear;
            }

            if (easingZ == null)
            {
                // give the default value
                easingZ = Easing.Linear;
            }

            _EasingX = easingX;
            _EasingY = easingY;
            _EasingZ = easingZ;
            SetCallback(callback);

            _From = from;
            _To   = to;

            _Duration.x    = durationX;
            _ProgressPct.x = 0f;

            _Duration.y    = durationY;
            _ProgressPct.y = 0f;

            _Duration.z    = durationZ;
            _ProgressPct.z = 0f;

            _AnimatingX = true;
            _AnimatingY = true;
            _AnimatingZ = true;

            if (resetElapsedTime)
            {
                _TimeElapsed.x = 0f;
                _TimeElapsed.y = 0f;
                _TimeElapsed.z = 0f;
            }
        }
 static public void LoadObjectExternal(string path, string file, CallBackDelegate <object, object> callBack)
 {
     if (AsyncResourceManager.CheckLoaded(ResourceURL.GetExternalPath(path + file)) || AsyncResourceManager.CheckAssetBundleLoaderAsync(ResourceURL.GetExternalPath(path + file)))
     {
         AsyncResourceManager.LoadExternalAsync(path, file, callBack);
         return;
     }
     SyncResourceManager.InternalLoadAsset(path, file, callBack, ResourceURL.GetExternalPath, SyncResourceManager.GetAllDependenciesExternal, SyncResourceManager.LoadExternalGoFunc);
 }
 static public void UnityLoadScene(string sceneName, CallBackDelegate <object, object> callBack)
 {
     SceneManager.LoadScene(sceneName);
     if (callBack != null)
     {
         callBack(null, null);
         // callBack.Call();
     }
 }
        public ThreadedExecuter(MethodDelegate method, CallBackDelegate callback, Boolean IsSynchronous = false)
        {
            this.methodDelegate   = method;
            this.callBackDelegate = callback;
            this.threadType       = ThreadType.Resource;
            t = new Thread(new ParameterizedThreadStart(this.Process));

            this.IsSynchronous = IsSynchronous;
        }
 public void RemoveSubscription(String pTopic, CallBackDelegate pHandlerAddress)
 {
     if (sTopicSubscriptions.ContainsKey(pTopic))
     {
         if (sTopicSubscriptions[pTopic].Contains(pHandlerAddress))
         {
             sTopicSubscriptions[pTopic].Remove(pHandlerAddress);
         }
     }
 }
        /// <summary>
        /// Initializes a new instance of WebCameraDevice object
        /// </summary>
        /// <param name="width">Frame width in pixels</param>
        /// <param name="height">Frame height in pixels</param>
        /// <param name="preferredFPS">
        /// Preferred Frames Per Second. Available values are between 0 and 30
        /// Set value to 0, for manual frame grabbing
        /// </param>
        /// <param name="camID">Device ID</param>
        /// <param name="parentHwnd">Parent's handle</param>
        public WebCameraDevice(int frameWidth, int frameHeight, int preferredFPS, int camID, int parentHwnd)
        {
            this.frameWidth = frameWidth;
             this.frameHeight = frameHeight;
             this.parentHwnd = parentHwnd;
             this.camID = camID;
             PreferredFPS = preferredFPS;

             delegateFrameCallBack = FrameCallBack;
        }
 public void AddSubscription(String pTopic, CallBackDelegate pCallBack)
 {
     if (!sTopicSubscriptions.ContainsKey(pTopic))
     {
         sTopicSubscriptions.Add(pTopic, new List<CallBackDelegate>());
     }
     if (!sTopicSubscriptions[pTopic].Contains(pCallBack))
     {
         sTopicSubscriptions[pTopic].Add(pCallBack);
     }
 }
Beispiel #37
0
 private void button1_Click(object sender, EventArgs e)
 {
     dbo1 = new DBOperate("Mysql", strUrl1, "TRACKING_TEST");
     dbo2 = new DBOperate("Mysql", strUrl2, "TRACKING");
     iID=int.Parse(tbBeginID.Text.Trim());
     iCount = int.Parse(tbCount.Text.Trim());
     isOperate = true;
     button1.Enabled = false;
     CallBackDelegate cbd = new CallBackDelegate(this.CallBack);
     new Thread(new ParameterizedThreadStart(this.ThreadFun)).Start(cbd);
 }
Beispiel #38
0
	/// <summary>
	/// Eases from value to value.
	/// </summary>
	/// <param name="from">From.</param>
	/// <param name="to">To.</param>
	/// <param name="duration">Duration.</param>
	/// <param name="easing">Easing.</param>
	public void easeFromTo( Vector3 from,  Vector3 to, float duration=1f, TweenDelegate easing=null, CallBackDelegate callback=null )
	{
		if(easing==null)
		{
			easing = Easing.Linear;
		}

		_Easing 	= easing;
		_Callback	= callback;

		_From 	= from;
		_To		= to;

		_Duration 		= duration;
		_TimeElapsed 	= 0f;
		_ProgressPct	= 0f;

		_Animating = true;
	}
Beispiel #39
0
        private void loadWDMDB()
        {
            this.airs = WDMIntegrationModule.getAircs();//取数据源动作
            string msg = "";
            if (this.airs == null)
            {
                msg="机型没有读取成功,请检查参数配置.";
            }
            //else
            //{
            //    TreeNode parentNode = new TreeNode("WDM机型列表");
            //    this.WDMTree.Nodes.Add(parentNode);
            //    for (int i = 0; i < airs.Length; i++)
            //    {
            //        TreeNode childNode = new TreeNode();
            //        childNode.Name = airs[i].ID;
            //        childNode.Text = airs[i].MC;
            //        childNode.Tag = i;
            //        parentNode.Nodes.Add(childNode);
            //    }
            //    this.WDMTree.ExpandAll();
            //}

            //执行回调.
            if (this.InvokeRequired)
            {
                CallBackDelegate cbd = new CallBackDelegate(callBack);
                this.BeginInvoke(cbd, msg); //异步调用回调
                //this.Invoke(cbd, msg); //同步调用回调
            }
            else
            {
                this.Close();
            }
        }
Beispiel #40
0
 public static void GetBusLines(string strLineName, CallBackDelegate callBack)
 {
     GetCity();
     string strUri = m_strBaseUrl + TYPE_LINES + "?app_key=" + m_strKey + "&city=" + m_strCity + "&q=" + strLineName;
     DoWebClient(strUri, callBack);
 }
Beispiel #41
0
 public static void GetStats(string strStatName, CallBackDelegate callBack)
 {
     GetCity();
     string strUri = m_strBaseUrl + TYPE_STATS + "?app_key=" + m_strKey + "&city=" + m_strCity + "&q=" + strStatName;
     DoWebClient(strUri, callBack);
 }
Beispiel #42
0
 public static void GetNearbyStats(string lng, string lat, string dist, CallBackDelegate callBack)
 {
     GetCity();
     string strUri = m_strBaseUrl + TYPE_STATS_XY + "?app_key=" + m_strKey + "&city=" + m_strCity + "&lng=" + lng + "&lat=" + lat + "&dist=" + dist;
     DoWebClient(strUri, callBack);
 }
Beispiel #43
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Client" /> class.
 /// </summary>
 /// <param name="callback">The callback.</param>
 /// <param name="ip">The IP address of the server.</param>
 public Client(CallBackDelegate callback, string ip)
 {
     this.clientDelegate = callback;
     this.address = ip;
 }
 private static extern bool LaunchOnline(POnlineClock[] onlineClock, int APort, RequestDelegate TRequestCallBack, CallBackDelegate Callback, CallBackDelegate Callback1);
Beispiel #45
0
        public void AdminAction(CallBackDelegate callback)
        {
            if (callback != null)
            {
                if (GlobalVar.CheckUserForm == null)
                {
                    GlobalVar.CheckUserForm = new FrmSuperUser();
                }
                GlobalVar.CheckUserForm.CallBack += callback;
                GlobalVar.CheckUserForm.ShowDialog();

            }
            else
            {
                ShowInformationMessage("請設置用戶檢驗callback函數。");
            }
        }
Beispiel #46
0
        // Dictionary<string, ConnectionClient> dictConn = new Dictionary<string, ConnectionClient>();
        private void btnConnect_Click(object sender, EventArgs e)
        {
            //实例化 套接字
            sokClient = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
            //创建 ip对象
            IPAddress address = IPAddress.Parse(txtIP.Text.Trim());
            //MessageBox.Show("address");
            //创建网络节点对象 包含 ip和port
            IPEndPoint endpoint = new IPEndPoint(address, int.Parse(txtPort.Text.Trim()));
            //连接 服务端监听套接字
            sokClient.Connect(endpoint);

            //创建负责接收 服务端发送来数据的 线程

            CallBackDelegate cbd = new CallBackDelegate(this.CallBack);
            new Thread(new ParameterizedThreadStart(this.ReceiveMsg)).Start(cbd);

            //threadClient = new Thread(ReceiveMsg);
            //threadClient.IsBackground = true;
            ////如果在win7下要通过 某个线程 来调用 文件选择框的代码,就需要设置如下
            //threadClient.SetApartmentState(ApartmentState.STA);
            //threadClient.Start();
        }
Beispiel #47
0
 public static void GetBusRoutes(string strStart, string strEnd, int rc, CallBackDelegate callBack)
 {
     GetCity();
     string strUri = m_strBaseUrl + TYPE_TRANSFER + "?app_key=" + m_strKey + "&city=" + m_strCity + "&start_addr=" + strStart + "&end_addr=" + strEnd + "&rc=" + rc;
     DoWebClient(strUri, callBack);
 }
Beispiel #48
0
 public void Subscribe(string pTopic, CallBackDelegate pCallBack)
 {
     Console.WriteLine("Subscription for " + pTopic + " received");
     SubscriptionRegistry.Instance.AddSubscription(pTopic, pCallBack);
 }
        public WebCamGrabber(int frameWidth, int frameHeight, int preferredFPS, int camID, IntPtr parentHwnd)
        {
            Devices = new List<DeviceInfo>();
            GetAllCapturesDevices();

            this.frameWidth = frameWidth;
            this.frameHeight = frameHeight;
            this.m_hWnd = parentHwnd;
            this.camID = camID;
            PreferredFPS = preferredFPS;

            delegateFrameCallBack = FrameCallBack;
        }
Beispiel #50
0
 public void Unsubscribe(string pTopic, CallBackDelegate pCaller)
 {
     SubscriptionRegistry.Instance.RemoveSubscription(pTopic, pCaller);
 }
 static extern int SendHeaderMessage(int hWnd, uint wMsg, int wParam, CallBackDelegate lParam);
Beispiel #52
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (!checkType())
            {
                Log(strMsg, "ABNORMAL", lstView);
                return;
            }

            strStartTime = txtStartTime.Text.Trim();
            strEndTime = txtEndTime.Text.Trim();
            strEquip = txtEquip.Text;

            button1.Text = "正在执行...";
            button1.Enabled = false;

            CallBackDelegate cbd = new CallBackDelegate(this.CallBack);
            new Thread(new ParameterizedThreadStart(this.ThreadFun)).Start(cbd);
        }
        public void t()
        {
            try
            {
                POnlineClock c = new POnlineClock();

                Delegate1 = TRequestCallBack;
                Delegate2 = TDoneCallBack;

                //int a = SetRemoteIPEx(this._DevicePort, "192.168.1.132".ToCharArray(), 5302, 3, 1, 1, null, 0);
                //int b = 1;

                bool con = ER_ConnNet("192.168.20.200".ToCharArray(), 4001, 1);

                POnlineClock[] a = new POnlineClock[1];

                POnlineClock poc = new POnlineClock();
                poc.Clock_id = 1;
                poc.IPAddr = "192.168.20.200";
                poc.Port = 4001;
                poc.Connected = true;
                // poc.Connected = true;

                //        public int Clock_id;                         // 机号
                //public char[] IPAddr;                  // 设备网络IP
                //public int Port;                         // 设备网络端口
                //public bool Connected;
                //public int kModel;
                //public DateTime LastHeartTime;

                a[0] = poc;
                bool istrue = LaunchOnline(a, 8002, Delegate1, Delegate2, null);
                //  bool stop = StopOnline();

                int b = 0;
            }
            catch
            {

            }
        }
Beispiel #54
0
        /// <summary>
        /// 获取结果
        /// </summary>
        private void FetchResult()
        {
            codeBll = new ValidCodeBll();
            codeBll.mainUrl = mainUrl;
            codeBll.imageUrl = imageUrl;

            int inditator = vehicleLs.Count;
            string tempResult = "";

            foreach (MVehicle temp in vehicleLs)
            {

                tempResult = codeBll.GetCheckResult(temp.CardNo, temp.VinNo);

                //选择
                if (tempResult == "SaveAndExit")
                {
                    status = "正在保存结果,程序即将退出...";
                    //如果网络已经异常,说明工作已经保存
                    if (isError)
                    {
                        System.Environment.Exit(0);
                    }
                    else
                    {
                        isError = true;
                        CallBack();
                        System.Environment.Exit(0);
                    }
                }

                if (tempResult == "Retry")
                {
                    status = "正在重试重新连接,已为您保存最后的工作...";
                    isError = true;
                    CallBack();
                }

                while (tempResult == "Retry")
                {
                    //隔1秒查询一下网络状态
                    Thread.Sleep(1000);
                    tempResult = codeBll.GetStatus(temp.CardNo, temp.VinNo);
                    if (tempResult == "OK")
                    {
                        isError = false;
                        break;
                    }
                }

                temp.CheckResult = tempResult;
                currentNum = currentNum + 1;
                string formatString = "正在获取车牌号为{0}的违章信息({1}/{2})...";
                status = String.Format(formatString, temp.CardNo,currentNum,inditator);
            }

            //停止后台线程更新界面
            statusStop = true;
            timeStop = true;
            toolStripStatusLabel2.Text = "查询结束";
            CallBackDelegate cbd = new CallBackDelegate(CallBack);
            this.Invoke(cbd);
        }
Beispiel #55
0
        /// <summary> 
        /// 弹出窗体 
        /// </summary> 
        /// <param name="titleText">标题</param> 
        /// <param name="contentText">内容</param> 
        /// <param name="myDelegate">单击内容区域执行的方法,可以为null</param> 
        public void Pop(string titleText, string contentText, CallBackDelegate myDelegate)
        {
            this.titleText = titleText;
            this.contentText = contentText;
            this.myDelegate = myDelegate;

            this.Width = backgroundBitmap.Width;
            this.Height = 0;

            this.workAreaRectangle = Screen.GetWorkingArea(workAreaRectangle);
            this.Top = workAreaRectangle.Height;
            this.SetBounds(workAreaRectangle.Width - this.Width, workAreaRectangle.Height - currentTop, this.Width, this.Height);

            this.currentState = FormState.UpToShow;
            this.moveTimer.Enabled = true;

            ShowWindow(this.Handle, 4); //#define SW_SHOWNOACTIVATE 4
        }