예제 #1
0
        protected override void OnStartup(StartupEventArgs e)
        {
            /*Uri uri = new Uri("PresentationFramework.Luna;V3.0.0.0;31bf3856ad364e35;component\\themes/Luna.Homestead.xaml", UriKind.Relative);
             * Resources.MergedDictionaries.Add(Application.LoadComponent(uri) as ResourceDictionary);*/

            //Due to a bug in WPF, even though this dictionary is defined in App.xaml, it only gets loaded in desing time and not in runtime. To get around this bug it has to be added again here
            //see https://stackoverflow.com/questions/543414/app-xaml-file-does-not-get-parsed-if-my-app-does-not-set-a-startupuri
            Uri uri2 = new Uri("GUI/DarkTheme.xaml", UriKind.Relative);

            Resources.MergedDictionaries.Add(Application.LoadComponent(uri2) as ResourceDictionary);


            base.OnStartup(e);
            if (checkLicense)
            {
                GUI.LicenseWindow licenseCheck = new GUI.LicenseWindow();
                licenseCheck.ShowDialog();
                if (!licenseCheck.success)
                {
                    this.Shutdown();
                    return;
                }
            }
            GUI.BotWindow botWindow = new GUI.BotWindow();
            if (onBotStartup != null)
            {
                botWindow.Loaded += (a, b) => onBotStartup(args);
            }
            botWindow.Closed += (a, b) => this.Shutdown();
            botWindow.Show();
        }
예제 #2
0
        public GUIDataExchange(GUI.UserPanel userPanel, GUI.TaskPanel taskPanel, GUI.PixelCanvas pixelCanvas, GUI.BotWindow botWindow, GUI.TimelapsePanel timelapsePanel, GUIHelper helper)
        {
            this.userPanel      = userPanel;
            this.taskPanel      = taskPanel;
            this.pixelCanvas    = pixelCanvas;
            this.botWindow      = botWindow;
            this.timelapsePanel = timelapsePanel;
            this.guiHelper      = helper;

            InitModels();
        }
예제 #3
0
        private void Startup(Dictionary <ArgsParser.ArgName, Dictionary <string, object> > args)
        {
            //Create palettes
            var palette = new Dictionary <int, Dictionary <int, System.Drawing.Color> >()
            {
                {
                    7, new Dictionary <int, System.Drawing.Color>()
                    {
                        { 0, System.Drawing.Color.FromArgb(0xFF, 0xFF, 0xFF) },
                        { 1, System.Drawing.Color.FromArgb(0xC4, 0xC4, 0xC4) },
                        { 2, System.Drawing.Color.FromArgb(0x88, 0x88, 0x88) },
                        { 17, System.Drawing.Color.FromArgb(0x55, 0x55, 0x55) },
                        { 3, System.Drawing.Color.FromArgb(0x22, 0x22, 0x22) },
                        { 18, System.Drawing.Color.FromArgb(0x00, 0x00, 0x00) },
                        { 4, System.Drawing.Color.FromArgb(0xFF, 0xA7, 0xD1) },
                        { 14, System.Drawing.Color.FromArgb(0xCF, 0x6E, 0xE4) },
                        { 19, System.Drawing.Color.FromArgb(0xec, 0x08, 0xec) },
                        { 15, System.Drawing.Color.FromArgb(0x82, 0x00, 0x80) },
                        { 20, System.Drawing.Color.FromArgb(0x6b, 0x00, 0x00) },
                        { 5, System.Drawing.Color.FromArgb(0xE5, 0x00, 0x00) },
                        { 21, System.Drawing.Color.FromArgb(0xff, 0x39, 0x04) },
                        { 6, System.Drawing.Color.FromArgb(0xE5, 0x95, 0x00) },
                        { 8, System.Drawing.Color.FromArgb(0xE5, 0xD9, 0x00) },
                        { 16, System.Drawing.Color.FromArgb(0xff, 0xdf, 0xcc) },
                        { 7, System.Drawing.Color.FromArgb(0xA0, 0x6A, 0x42) },
                        { 22, System.Drawing.Color.FromArgb(0x63, 0x3c, 0x1f) },
                        { 9, System.Drawing.Color.FromArgb(0x94, 0xE0, 0x44) },
                        { 23, System.Drawing.Color.FromArgb(0x51, 0xe1, 0x19) },
                        { 10, System.Drawing.Color.FromArgb(0x02, 0xBE, 0x01) },
                        { 24, System.Drawing.Color.FromArgb(0x00, 0x66, 0x00) },
                        { 11, System.Drawing.Color.FromArgb(0x00, 0xD3, 0xDD) },
                        { 25, System.Drawing.Color.FromArgb(0x36, 0xba, 0xff) },
                        { 12, System.Drawing.Color.FromArgb(0x00, 0x83, 0xC7) },
                        { 26, System.Drawing.Color.FromArgb(0x04, 0x4b, 0xff) },
                        { 13, System.Drawing.Color.FromArgb(0x00, 0x00, 0xEA) },
                        { 27, System.Drawing.Color.FromArgb(0xbb, 0x4f, 0x00) },//premium 1
                        { 28, System.Drawing.Color.FromArgb(0x45, 0xff, 0xc8) }//premium 2
                    }
                },
                {
                    6, new Dictionary <int, System.Drawing.Color>()
                    {
                        { 0, System.Drawing.Color.FromArgb(0xCA, 0xDC, 0x9F) },
                        { 1, System.Drawing.Color.FromArgb(0x9B, 0xBC, 0x0F) },
                        { 2, System.Drawing.Color.FromArgb(0x8B, 0xAC, 0x0F) },
                        { 3, System.Drawing.Color.FromArgb(0x30, 0x92, 0x30) },
                        { 4, System.Drawing.Color.FromArgb(0x0F, 0x38, 0x0F) }
                    }
                },
                {
                    666, new Dictionary <int, System.Drawing.Color>()
                    {
                        { 0, System.Drawing.Color.FromArgb(0xFF, 0xFF, 0xFF) },
                        { 1, System.Drawing.Color.FromArgb(0xC4, 0xC4, 0xC4) },
                        { 2, System.Drawing.Color.FromArgb(0x88, 0x88, 0x88) },
                        { 3, System.Drawing.Color.FromArgb(0x22, 0x22, 0x22) }
                    }
                }
            };
            Dictionary <int, List <System.Drawing.Color> > GUIPalette = palette.Select((a) =>
            {
                return(new KeyValuePair <int, List <System.Drawing.Color> >(a.Key, a.Value.Select((b) => b.Value).ToList()));
            }).ToDictionary((a) => a.Key, (a) => a.Value);

            GUIPalette[7].RemoveRange(27, 2); //dont show premium color in UI

            //Create or get everything
            foreach (object w in app.Windows)
            {
                if (w is GUI.BotWindow)
                {
                    window = w as GUI.BotWindow;
                    break;
                }
            }

            helper         = new GUIHelper(GUIPalette);
            dataExchange   = new GUIDataExchange(window.usersPanel, window.taskList, window.pixelCanvas, window, window.timelapsePanel, helper);
            representation = new UsefulDataRepresentation(dataExchange);
            updater        = new GUIUpdater(palette);
            manager        = new UserManager(representation, updater, palette);
            loader         = new DataLoader(dataExchange, helper);

            //Set window properties
            window.Helper             = helper;
            window.taskList.Helper    = helper;
            window.pixelCanvas.Helper = helper;
            window.DataExchange       = dataExchange;
            window.Launcher           = this;

            //Set window children properties
            window.taskList.DataExchange    = dataExchange;
            window.usersPanel.DataExchange  = dataExchange;
            window.usersPanel.Launcher      = this;
            window.pixelCanvas.DataExchange = dataExchange;

            //Set updater properties
            updater.DataExchange = dataExchange;
            updater.Manager      = manager;

            //Set dataexchange properties
            dataExchange.UsefulData = representation;
            dataExchange.Updater    = updater;

            //Set helper properties
            helper.DataExchange = dataExchange;

            //Load saved data
            loader.Load();

            //Load args
            ArgsProcessor processor = new ArgsProcessor(args, dataExchange);

            processor.ApplyArgs();

            //Start loading data
            window.Run();
            window.pixelCanvas.Run();

            startupExecuted = true;
        }