Ejemplo n.º 1
0
        private void BtnGo_OnClick(object sender, RoutedEventArgs e)
        {
            var t = TaskHost;
            TaskHost = t;

            var task = new KnowyourmemeComLoaderTaskGroup
            {
                StartSuffix = TextBox.Text
            };

            TaskHost.AddTask(task, Settings.Default.ThreadCount);
            TaskHost.Run();
        }
Ejemplo n.º 2
0
        private void OnAppStartup(object sender, StartupEventArgs e)
        {
            logger      = new Logger(Settings.Default.Log);
            faultLogger = new Logger(Settings.Default.FaultLog, true);
            WebProxy proxy = null;

            if (Settings.Default.UseProxy)
            {
                proxy = WebProxy.GetDefaultProxy();
                if (!string.IsNullOrEmpty(Settings.Default.ProxyLogin))
                {
                    proxy.Credentials = new NetworkCredential(
                        Settings.Default.ProxyLogin,
                        Settings.Default.ProxyPassword);
                }
            }

            var host = new TaskHost
            {
                Logger    = logger,
                Proxy     = proxy,
                SpeedTest = new SpeedTest()
            };

            taskHost         = host;
            trayIcon.Visible = true;

            if (Settings.Default.AutoResume && File.Exists(Settings.Default.LastStateFile))
            {
                var state = File.ReadAllText(Settings.Default.LastStateFile, Encoding.Default);

                var task = new KnowyourmemeComLoaderTaskGroup();
                task.SetState(state);
                taskHost.AddTask(task, Settings.Default.ThreadCount);
                taskHost.Run();
            }
            else
            {
                new MainWindow(taskHost).Show();
            }
        }