Exemplo n.º 1
0
        void LazyUpdateNotifyText()
        {
            if (lazyUpdateNotifyTextTimer == null)
            {
                lazyUpdateNotifyTextTimer =
                    new Model.BaseClass.CancelableTimeout(
                        UpdateNotifierText,
                        1000);
            }

            lazyUpdateNotifyTextTimer.Start();
        }
Exemplo n.º 2
0
        public void LazyGC()
        {
            // Create on demand.
            if (lazyGCTimer == null)
            {
                var delay = Lib.Utils.Str2Int(StrConst("LazyGCDelay"));

                lazyGCTimer = new Model.BaseClass.CancelableTimeout(
                    () =>
                {
                    System.GC.Collect();
                }, delay * 1000);
            }

            lazyGCTimer.Start();
        }
Exemplo n.º 3
0
        void LazySaveServerList()
        {
            // create on demand
            if (lazySaveServerListTimer == null)
            {
                var delay = Lib.Utils.Str2Int(StrConst("LazySaveServerListDelay"));

                lazySaveServerListTimer =
                    new Model.BaseClass.CancelableTimeout(
                        () => setting.SaveServerList(serverList),
                        delay * 1000);
            }

            lazySaveServerListTimer.Start();
            Task.Factory.StartNew(() => UpdateNotifierText());
        }
Exemplo n.º 4
0
        void LazySaveServerList()
        {
            // create on demand
            if (lazySaveServerListTimer == null)
            {
                var delay = Lib.Utils.Str2Int(StrConst("LazySaveServerListDelay"));

                lazySaveServerListTimer =
                    new Model.BaseClass.CancelableTimeout(
                        () =>
                {
                    string json = JsonConvert.SerializeObject(serverList);
                    Properties.Settings.Default.ServerList = json;
                    Properties.Settings.Default.Save();
                },
                        delay * 1000);
            }

            lazySaveServerListTimer.Start();

            Task.Factory.StartNew(() => CheckRunningServersCount());
        }