public MainWindow()
{
try
{
var sw = new Stopwatch();
sw.Start();
_bufferManager = BufferManager.Instance;
_configrationDirectoryPaths.Add("Settings", Path.Combine(_serviceManager.Paths["Configuration"], @"Settings"));
_configrationDirectoryPaths.Add("AmoebaManager", Path.Combine(_serviceManager.Paths["Configuration"], @"AmoebaManager"));
_configrationDirectoryPaths.Add("ConnectionSettingManager", Path.Combine(_serviceManager.Paths["Configuration"], @"ConnectionSettingManager"));
_configrationDirectoryPaths.Add("OverlayNetworkManager", Path.Combine(_serviceManager.Paths["Configuration"], @"OverlayNetworkManager"));
_configrationDirectoryPaths.Add("TransfarLimitManager", Path.Combine(_serviceManager.Paths["Configuration"], @"TransfarLimitManager"));
_configrationDirectoryPaths.Add("CatharsisManager", Path.Combine(_serviceManager.Paths["Configuration"], @"CatharsisManager"));
Settings.Instance.Load(_configrationDirectoryPaths["Settings"]);
InitializeComponent();
this.Setting_Log();
this.Title = string.Format("Amoeba {0}", _serviceManager.AmoebaVersion);
{
var icon = new BitmapImage();
icon.BeginInit();
icon.StreamSource = new FileStream(Path.Combine(_serviceManager.Paths["Icons"], "Amoeba.ico"), FileMode.Open, FileAccess.Read, FileShare.Read);
icon.EndInit();
if (icon.CanFreeze) icon.Freeze();
this.Icon = icon;
}
var myIcon = new System.Drawing.Icon(Path.Combine(_serviceManager.Paths["Icons"], "Amoeba.ico"));
_notifyIcon.Icon = new System.Drawing.Icon(myIcon, new System.Drawing.Size(16, 16));
_notifyIcon.Visible = true;
this.Setting_Init();
this.Setting_Languages();
_notifyIcon.Visible = false;
_notifyIcon.Click += (object sender2, EventArgs e2) =>
{
if (_closed) return;
try
{
this.Show();
this.Activate();
this.WindowState = _windowState;
_notifyIcon.Visible = false;
}
catch (Exception)
{
}
};
_timerThread = new Thread(this.TimerThread);
_timerThread.Priority = ThreadPriority.Lowest;
_timerThread.Name = "MainWindow_TimerThread";
_timerThread.Start();
_statusBarThread = new Thread(this.StatusBarThread);
_statusBarThread.Priority = ThreadPriority.Highest;
_statusBarThread.Name = "MainWindow_StatusBarThread";
_statusBarThread.Start();
_trafficMonitorThread = new Thread(this.TrafficMonitorThread);
_trafficMonitorThread.Priority = ThreadPriority.Highest;
_trafficMonitorThread.Name = "MainWindow_TrafficMonitorThread";
_trafficMonitorThread.Start();
_transferLimitManager.StartEvent += _transferLimitManager_StartEvent;
_transferLimitManager.StopEvent += _transferLimitManager_StopEvent;
#if !DEBUG
_logRowDefinition.Height = new GridLength(0);
#endif
sw.Stop();
Debug.WriteLine("StartUp {0}", sw.ElapsedMilliseconds);
}
catch (Exception e)
{
Log.Error(e);
throw;
}
}