Example #1
0
        void Dispose(bool disposing)
        {
            if (_lock != null)
            {
                if (disposing)
                {
                    ClearAllLevels();
                }

                _levels.Clear();
                _levels = null;

                _tmp.Clear();
                _tmp = null;

                _lock.Dispose();
                _lock = null;
            }
        }
        void Dispose(bool disposing)
        {
            if (Lock != null)
            {
                if (disposing)
                {
                    ClearAllLevels();
                }

                Levels.Clear();
                Levels = null;

                tmp.Clear();
                tmp = null;

                Lock.Dispose();
                Lock = null;
            }
        }
Example #3
0
        void Dispose(bool disposing)
        {
            if (IsStarted)
            {
                if (invalidator != null)
                {
                    invalidator.CancelAsync();
                    invalidator.DoWork -= new DoWorkEventHandler(invalidatorWatch);
                    invalidator.Dispose();
                    invalidator = null;
                }

                if (Refresh != null)
                {
                    Refresh.Set();
                    Refresh.Close();
                    Refresh = null;
                }

                int x = Interlocked.Decrement(ref instances);
                Debug.WriteLine("OnMapClose: " + x);

                CancelAsyncTasks();
                IsStarted = false;

                if (Matrix != null)
                {
                    Matrix.Dispose();
                    Matrix = null;
                }

                if (FailedLoads != null)
                {
                    lock (FailedLoads)
                    {
                        FailedLoads.Clear();
                        RaiseEmptyTileError = false;
                    }
                    FailedLoads = null;
                }

                // cancel waiting loaders
                Monitor.Enter(tileLoadQueue);
                try
                {
                    Monitor.PulseAll(tileLoadQueue);
                    tileDrawingList.Clear();
                }
                finally
                {
                    Monitor.Exit(tileLoadQueue);
                }

                lock (GThreadPool)
                {
#if PocketPC
                    Debug.WriteLine("waiting until loaders are stopped...");
                    while (GThreadPool.Count > 0)
                    {
                        var t = GThreadPool[0];

                        if (t.State != ThreadState.Stopped)
                        {
                            var tr = t.Join(1111);

                            Debug.WriteLine(t.Name + ", " + t.State);

                            if (!tr)
                            {
                                continue;
                            }
                            else
                            {
                                GThreadPool.Remove(t);
                            }
                        }
                        else
                        {
                            GThreadPool.Remove(t);
                        }
                    }
                    Thread.Sleep(1111);
#endif
                }

                if (tileDrawingListLock != null)
                {
                    tileDrawingListLock.Dispose();
                    tileDrawingListLock = null;
                    tileDrawingList     = null;
                }

                if (x == 0)
                {
#if DEBUG
                    GMaps.Instance.CancelTileCaching();
#endif
                    GMaps.Instance.noMapInstances = true;
                    GMaps.Instance.WaitForCache.Set();
                    if (disposing)
                    {
                        GMaps.Instance.MemoryCache.Clear();
                    }
                }
            }
        }
Example #4
0
        void Dispose(bool disposing)
        {
            if (IsStarted)
            {
                if (invalidator != null)
                {
                    invalidator.CancelAsync();
                    invalidator.DoWork -= new DoWorkEventHandler(invalidatorWatch);
                    invalidator.Dispose();
                    invalidator = null;
                }

                if (Refresh != null)
                {
                    Refresh.Set();
                    Refresh.Close();
                    Refresh = null;
                }

                int x = Interlocked.Decrement(ref instances);
                Debug.WriteLine("OnMapClose: " + x);


                // URLに対するアクセス回数保存用処理ここから
                // テキストファイルを開く
                Encoding sjisEnc = Encoding.GetEncoding("Shift_JIS");

                //プラグインフォルダ
                string settingFilePath = System.Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\ACSL\X-Monitor\Setting\GUI\Settings.xml";

                // XMLファイルからxmlデータに読み込む
                XDocument xml = XDocument.Load(settingFilePath);

                // TempFile読み込み
                var    elements = xml.Root.XPathSelectElements("Settings/FilePath/TempFile");
                string temp     = string.Empty;
                foreach (var element in elements)
                {
                    temp = element.Value;
                }

                //string folder = System.IO.Path.GetDirectoryName(
                //    System.Reflection.Assembly
                //    .GetExecutingAssembly().Location);
                string strUrlCounterFileName = temp + "\\UrlCounter.txt";
                Debug.WriteLine(
                    string.Concat(
                        "strUrlCounterFileName -> ",
                        strUrlCounterFileName
                        )
                    );

                StreamWriter writer = new StreamWriter(@strUrlCounterFileName, false, sjisEnc);
                writer.WriteLine(GMapProvider.strUrlCountDate);
                foreach (var elem in GMapProvider.dicUrlCount)
                {
                    writer.WriteLine(elem.Key + "," + elem.Value.ToString());
                }

                writer.Close();
                // URLに対するアクセス回数保存用処理ここまで


                CancelAsyncTasks();
                IsStarted = false;

                if (Matrix != null)
                {
                    Matrix.Dispose();
                    Matrix = null;
                }

                if (FailedLoads != null)
                {
                    lock (FailedLoads)
                    {
                        FailedLoads.Clear();
                        RaiseEmptyTileError = false;
                    }
                    FailedLoads = null;
                }

                // cancel waiting loaders
                Monitor.Enter(tileLoadQueue);
                try
                {
                    Monitor.PulseAll(tileLoadQueue);
                    tileDrawingList.Clear();
                }
                finally
                {
                    Monitor.Exit(tileLoadQueue);
                }

                lock (GThreadPool)
                {
#if PocketPC
                    Debug.WriteLine("waiting until loaders are stopped...");
                    while (GThreadPool.Count > 0)
                    {
                        var t = GThreadPool[0];

                        if (t.State != ThreadState.Stopped)
                        {
                            var tr = t.Join(1111);

                            Debug.WriteLine(t.Name + ", " + t.State);

                            if (!tr)
                            {
                                continue;
                            }
                            else
                            {
                                GThreadPool.Remove(t);
                            }
                        }
                        else
                        {
                            GThreadPool.Remove(t);
                        }
                    }
                    Thread.Sleep(1111);
#endif
                }

                if (tileDrawingListLock != null)
                {
                    tileDrawingListLock.Dispose();
                    tileDrawingListLock = null;
                    tileDrawingList     = null;
                }

                if (x == 0)
                {
#if DEBUG
                    GMaps.Instance.CancelTileCaching();
#endif
                    GMaps.Instance.noMapInstances = true;
                    GMaps.Instance.WaitForCache.Set();
                    if (disposing)
                    {
                        GMaps.Instance.MemoryCache.Clear();
                    }
                }
            }
        }
Example #5
0
      void Dispose(bool disposing)
      {
         if(kiberCacheLock != null)
         {
            if(disposing)
            {
               Clear();
            }

            kiberCacheLock.Dispose();
            kiberCacheLock = null;
         }
      }
        void Dispose(bool disposing)
        {
            if (IsStarted)
            {
                if (_invalidator != null)
                {
                    _invalidator.CancelAsync();
                    _invalidator.DoWork -= InvalidatorWatch;
                    _invalidator.Dispose();
                    _invalidator = null;
                }

                if (Refresh != null)
                {
                    Refresh.Set();
                    Refresh.Close();
                    Refresh = null;
                }

                int x = Interlocked.Decrement(ref Instances);
                Debug.WriteLine("OnMapClose: " + x);

                CancelAsyncTasks();
                IsStarted = false;

                if (Matrix != null)
                {
                    Matrix.Dispose();
                    Matrix = null;
                }

                if (FailedLoads != null)
                {
                    lock (FailedLoads)
                    {
                        FailedLoads.Clear();
                        _raiseEmptyTileError = false;
                    }

                    FailedLoads = null;
                }

                TileDrawingListLock.AcquireWriterLock();
                try
                {
                    TileDrawingList.Clear();
                }
                finally
                {
                    TileDrawingListLock.ReleaseWriterLock();
                }

#if NET46
                //TODO: maybe
#else
                // cancel waiting loaders
                Monitor.Enter(TileLoadQueue);
                try
                {
                    Monitor.PulseAll(TileLoadQueue);
                }
                finally
                {
                    Monitor.Exit(TileLoadQueue);
                }
#endif

                if (TileDrawingListLock != null)
                {
                    TileDrawingListLock.Dispose();
                    TileDrawingListLock = null;
                    TileDrawingList     = null;
                }

                if (x == 0)
                {
#if DEBUG
                    GMaps.Instance.CancelTileCaching();
#endif
                    GMaps.Instance.NoMapInstances = true;
                    GMaps.Instance.WaitForCache.Set();
                    if (disposing)
                    {
                        GMaps.Instance.MemoryCache.Clear();
                    }
                }
            }
        }
Example #7
0
        void Dispose(bool disposing)
        {
            if (IsStarted)
            {
                if (invalidator != null)
                {
                    invalidator.CancelAsync();
                    invalidator.DoWork -= new DoWorkEventHandler(InvalidatorWatch);
                    invalidator.Dispose();
                    invalidator = null;
                }

                if (Refresh != null)
                {
                    Refresh.Set();
                    Refresh.Close();
                    Refresh = null;
                }

                int x = Interlocked.Decrement(ref instances);
                Debug.WriteLine("OnMapClose: " + x);

                CancelAsyncTasks();
                IsStarted = false;

                if (Matrix != null)
                {
                    Matrix.Dispose();
                    Matrix = null;
                }

                if (FailedLoads != null)
                {
                    lock (FailedLoads)
                    {
                        FailedLoads.Clear();
                        RaiseEmptyTileError = false;
                    }
                    FailedLoads = null;
                }

                tileDrawingListLock.AcquireWriterLock();
                try
                {
                    tileDrawingList.Clear();
                }
                finally
                {
                    tileDrawingListLock.ReleaseWriterLock();
                }


                if (tileDrawingListLock != null)
                {
                    tileDrawingListLock.Dispose();
                    tileDrawingListLock = null;
                    tileDrawingList     = null;
                }

                if (x == 0)
                {
                    GMaps.Instance.noMapInstances = true;
                    GMaps.Instance.WaitForCache.Set();
                    if (disposing)
                    {
                        GMaps.Instance.MemoryCache.Clear();
                    }
                }
            }
        }