示例#1
0
        private void MainWindow_OnActivated(object sender, EventArgs e)
        {
            if (FirstTimeActivated)
            {
                FirstTimeActivated = false;

                var allAssemblies = new List <LeagueSharpAssembly>();
                foreach (var profile in Config.Instance.Profiles)
                {
                    allAssemblies.AddRange(profile.InstalledAssemblies);
                }

                allAssemblies = allAssemblies.Distinct().ToList();

                GitUpdater.ClearUnusedRepos(allAssemblies);
                PrepareAssemblies(allAssemblies, Config.Instance.FirstRun || Config.Instance.UpdateOnLoad, true, true);
                Remoting.Init();
            }

            var text = Clipboard.GetText();

            if (text.StartsWith(LSUriScheme.FullName))
            {
                Clipboard.SetText("");
                LSUriScheme.HandleUrl(text, this);
            }
        }
示例#2
0
        private void InitSystem()
        {
            PathRandomizer.CopyFiles();
            Remoting.Init();

            this.InjectThread = new Thread(
                () =>
            {
                var trigger = new EdgeTrigger();

                trigger.Rising += (sender, args) =>
                {
                    Application.Current.Dispatcher.InvokeAsync(
                        () =>
                    {
                        this.icon_connected.Visibility    = Visibility.Visible;
                        this.icon_disconnected.Visibility = Visibility.Collapsed;
                    });
                };

                trigger.Falling += (sender, args) =>
                {
                    Application.Current.Dispatcher.InvokeAsync(
                        async() =>
                    {
                        this.icon_connected.Visibility    = Visibility.Collapsed;
                        this.icon_disconnected.Visibility = Visibility.Visible;
                        await this.UpdateAccount();
                    });
                };

                while (true)
                {
                    try
                    {
                        Thread.Sleep(3000);

                        if (Config.Instance.Install)
                        {
                            Injection.Pulse();
                            trigger.Value = Injection.IsInjected;

                            Console.WriteLine(Injection.SharedMemory.Data.IsLoaded);
                        }
                    }
                    catch
                    {
                        // ignored - A task was canceled.
                    }
                }
            });

            this.InjectThread.SetApartmentState(ApartmentState.STA);
            this.InjectThread.Start();
        }
        private void OnLogin(string username)
        {
            Utility.Log(LogStatus.Ok, "Login", string.Format("Succesfully signed in as {0}", username), Logs.MainLog);
            this.Browser.Visibility    = Visibility.Visible;
            this.TosBrowser.Visibility = Visibility.Visible;

            try
            {
                Utility.MapClassToXmlFile(typeof(Config), Config.Instance, Directories.ConfigFilePath);
            }
            catch
            {
                MessageBox.Show(Utility.GetMultiLanguageText("ConfigWriteError"));
            }

            if (!PathRandomizer.CopyFiles())
            {
            }

            Remoting.Init();

            this.InjectThread = new Thread(
                () =>
            {
                while (true)
                {
                    if (Config.Instance.Install)
                    {
                        Injection.Pulse();
                    }

                    Application.Current.Dispatcher.Invoke(
                        () =>
                    {
                        if (Injection.IsInjected)
                        {
                            this.icon_connected.Visibility    = Visibility.Visible;
                            this.icon_disconnected.Visibility = Visibility.Collapsed;
                        }
                        else
                        {
                            this.icon_connected.Visibility    = Visibility.Collapsed;
                            this.icon_disconnected.Visibility = Visibility.Visible;
                        }
                    });

                    Thread.Sleep(3000);
                }
            });

            this.InjectThread.SetApartmentState(ApartmentState.STA);
            this.InjectThread.Start();
        }
示例#4
0
        private void InitSystem()
        {
            PathRandomizer.CopyFiles();
            Remoting.Init();

            this.InjectThread = new Thread(
                () =>
            {
                while (true)
                {
                    if (Config.Instance.Install)
                    {
                        Injection.Pulse();
                    }

                    Application.Current.Dispatcher.Invoke(
                        () =>
                    {
                        if (Injection.IsInjected)
                        {
                            this.icon_connected.Visibility    = Visibility.Visible;
                            this.icon_disconnected.Visibility = Visibility.Collapsed;
                        }
                        else
                        {
                            this.icon_connected.Visibility    = Visibility.Collapsed;
                            this.icon_disconnected.Visibility = Visibility.Visible;
                        }
                    });

                    Thread.Sleep(3000);
                }
            });

            this.InjectThread.SetApartmentState(ApartmentState.STA);
            this.InjectThread.Start();
        }