Exemple #1
0
        private void Setting_CheckDiskSpace()
        {
            bool watchFlag = true;

            _checkDiskSpaceTimer = new WatchTimer(() =>
            {
                if (!watchFlag)
                {
                    return;
                }

                try
                {
                    bool flag = false;

                    if (_amoebaInterfaceManager.Report.Core.Cache.FreeSpace < NetworkConverter.FromSizeString("10GB"))
                    {
                        flag |= true;
                    }

                    if (!flag)
                    {
                        if (_amoebaInterfaceManager.State == ManagerState.Stop)
                        {
                            _amoebaInterfaceManager.Start();
                            Log.Information("Start");
                        }
                    }
                    else
                    {
                        if (_amoebaInterfaceManager.State == ManagerState.Start)
                        {
                            _amoebaInterfaceManager.Stop();
                            Log.Information("Stop");

                            watchFlag = false;

                            App.Current.Dispatcher.InvokeAsync(() =>
                            {
                                if (_dialogService.ShowDialog(LanguagesManager.Instance.MainWindow_SpaceNotFound_Message,
                                                              MessageBoxButton.OKCancel, MessageBoxImage.Question, MessageBoxResult.Cancel) == MessageBoxResult.OK)
                                {
                                    watchFlag = true;
                                }
                            });
                        }
                    }
                }
                catch (Exception e)
                {
                    Log.Error(e);
                }
            });
            _checkDiskSpaceTimer.Start(new TimeSpan(0, 0, 0), new TimeSpan(0, 3, 0));
        }
Exemple #2
0
        private void Setting_CheckDiskSpace()
        {
            _checkDiskSpaceTimer = new WatchTimer(() =>
            {
                try
                {
                    bool flag = false;


                    if (_serviceManager.Report.Core.Cache.FreeSpace < NetworkConverter.FromSizeString("32GB") &&
                        _serviceManager.Report.Core.Cache.FreeSpace < (_serviceManager.Size / 3))
                    {
                        flag |= true;
                    }

                    if (!flag)
                    {
                        if (_serviceManager.State == ManagerState.Stop)
                        {
                            _serviceManager.Start();
                            Log.Information("Start");
                        }
                    }
                    else
                    {
                        if (_serviceManager.State == ManagerState.Start)
                        {
                            _serviceManager.Stop();
                            Log.Information("Stop");
                        }
                    }
                }
                catch (Exception e)
                {
                    Log.Error(e);
                }
            });
            _checkDiskSpaceTimer.Start(new TimeSpan(0, 0, 0), new TimeSpan(0, 0, 30));
        }
Exemple #3
0
        protected override void Dispose(bool isDisposing)
        {
            if (_isDisposed)
            {
                return;
            }
            _isDisposed = true;

            if (isDisposing)
            {
                EventHooks.Instance.SaveEvent -= this.Save;

                _watchManager.Dispose();

                _trafficViewTaskManager.Stop();
                _trafficViewTaskManager.Dispose();

                _trafficMonitorTaskManager.Stop();
                _trafficMonitorTaskManager.Dispose();

                _amoebaInterfaceManager.Stop();

                this.Save();

                this.CloudControlViewModel.Dispose();
                this.ChatControlViewModel.Dispose();
                this.StoreControlViewModel.Dispose();
                this.StorePublishControlViewModel.Dispose();
                this.SearchControlViewModel.Dispose();
                this.DownloadControlViewModel.Dispose();
                this.UploadControlViewModel.Dispose();

                _disposable.Dispose();

                _messageManager.Dispose();

                _amoebaInterfaceManager.Dispose();
            }
        }