Beispiel #1
0
        private void DoShowChatCmd()
        {
            var wnd = IoCHelper.GetIoC().Resolve <ChatWindow>();

            //wnd.ModelView.Browser = Browser;
            wnd.Show();
        }
Beispiel #2
0
        async private void DoRefreshHistory()
        {
            if (SelectedRanking != null)
            {
                var get = IoCHelper.GetIoC().Resolve <GetRankingHistory>();

                IsBusy = true;

                try
                {
                    get.PlayerName = SelectedRanking.PlayerName;
                    get.Continent  = SelectedRanking.Continent;

                    await Task.Run(() => Db.ExecuteWork(get));

                    if (get.Result != null)
                    {
                        EmpireHistRanking.Clear();

                        foreach (var r in get.Result)
                        {
                            EmpireHistRanking.Add(r);
                        }
                    }
                }
                finally
                {
                    IsBusy = false;
                }
            }
        }
Beispiel #3
0
        private void DoShowDataCollectCmd()
        {
            var wnd = IoCHelper.GetIoC().Resolve <DataColectWindow>();

            wnd.ModelView.Browser = Browser;
            wnd.Show();
        }
Beispiel #4
0
        private List <OffReputationHistory> GetOffRepHistory(string player)
        {
            var get = IoCHelper.GetIoC().Resolve <GetOffRepHistory>();

            get.PlayerName = player;
            Db.ExecuteWork(get);
            return(get.Result);
        }
Beispiel #5
0
        private List <UnitsKillsHistory> GetPlayerKillsHistory(string player)
        {
            var get = IoCHelper.GetIoC().Resolve <GetKillsHistory>();

            get.PlayerName = player;
            Db.ExecuteWork(get);
            return(get.Result);
        }
Beispiel #6
0
        private List <AlianceScoreHistory> GetAlianceHistory(string aliance, int continent)
        {
            var get = IoCHelper.GetIoC().Resolve <GetAlianceRankingHistory>();

            get.AlianceName = aliance;
            get.Continent   = continent;
            Db.ExecuteWork(get);
            return(get.Result);
        }
Beispiel #7
0
        private List <EmpireScoreHistory> GetPlayerHistory(string player, int continent)
        {
            var get = IoCHelper.GetIoC().Resolve <GetRankingHistory>();

            get.PlayerName = player;
            get.Continent  = continent;
            Db.ExecuteWork(get);
            return(get.Result);
        }
        public UCTroopsOverviewTable()
        {
            InitializeComponent();

            if (IoCHelper.IsInitialized)
            {
                this.grid.DataContext = IoCHelper.GetIoC().Resolve <UCTroopsOverviewTableMV>();
            }
        }
        public UCRaidsReports()
        {
            InitializeComponent();

            if (IoCHelper.IsInitialized)
            {
                this.grid.DataContext      = IoCHelper.GetIoC().Resolve <UCRaidsReportsMV>();
                ModelView.PropertyChanged += ModelView_PropertyChanged;
            }
        }
Beispiel #10
0
        public void Init()
        {
            Mapper.Initialize(cfg =>
            {
                cfg.AddProfile <GotGLib.NH.Schema.MapperProfile>();
            });
            Mapper.AssertConfigurationIsValid();

            IoC = IoCHelper.GetIoC();
            Db  = IoC.Resolve <Database>();
        }
 public UCTroopsOverviewTableMV()
 {
     if (IoCHelper.IsInitialized)
     {
         m_CitiesWithoutCommandsOnly = false;
         RefreshCmd  = new SimpleCommand(this, (p) => DoRefreshCmd(), (p) => !IsBusy);
         FilterCmd   = new SimpleCommand(this, (p) => Filter(), (p) => !IsBusy);
         JSInterface = IoCHelper.GetIoC().Resolve <JScriptInterface>();
         JSInterface.TroopsOverview += JSInterface_TroopsOverview;
         //DataView = (CollectionView)CollectionViewSource.GetDefaultView(OverviewData);
         //DataView.GroupDescriptions.Add(new PropertyGroupDescription("GroupingDesc"));
     }
 }
        public DataColectWindowMV()
        {
            IsBrowserInitialized      = false;
            InjectScriptsCmd          = new SimpleCommand(this, (p) => DoInjectScriptsCmd(), (p) => !IsBusy && Browser != null);
            DownloadEmpireRankingsCmd = new SimpleCommand(this, (p) => DoDownloadEmpireRankingsCmd(), (p) => !IsBusy);
            TestCmd = new SimpleCommand(this, (p) => DoTestCmd(), (p) => !IsBusy);

            if (IoCHelper.IsInitialized)
            {
                JSInterface           = IoCHelper.GetIoC().Resolve <JScriptInterface>();
                JSInterface.Progress += JSInterface_Progress;
            }
        }
        public UCRaidsReportsMV()
        {
            m_InsufficientCapacity = false;
            m_LastNReports         = 15;
            m_NewOnly = false;
            Cities    = new ObservableCollection <string>();

            if (IoCHelper.IsInitialized)
            {
                RefreshCmd  = new SimpleCommand(this, (p) => DoRefreshCmd(), (p) => !IsBusy);
                JSInterface = IoCHelper.GetIoC().Resolve <JScriptInterface>();
                JSInterface.CurrentRaidReports += JSInterface_CurrentRaidReports;
            }

            DataView = (CollectionView)CollectionViewSource.GetDefaultView(Reports);
        }
Beispiel #14
0
        private void DoRefreshPlayerName()
        {
            PlayerName      = JSInterface.GetPlayerName();
            MainWindowTitle = string.Format("CotGBrowser, {0} ({1})",
                                            Assembly.GetExecutingAssembly().GetName().Version.ToString(),
                                            PlayerName);

            if (!string.IsNullOrWhiteSpace(PlayerName))
            {
                m_Timer.IsEnabled = false;

                var dbHelper = IoCHelper.GetIoC().Resolve <DialectHelper>();
                StatusInfo = "DB file: " + dbHelper.DBFileName();

                HasAccess2Reports = true;
            }
        }
Beispiel #15
0
        public RankingsWindowMV()
        {
            RefreshRankingsCmd        = new SimpleCommand(this, (p) => DoRefreshRankingsCmd(), (p) => !IsBusy);
            RefreshPlotCmd            = new SimpleCommand(this, (p) => DoRefreshPlotCmd(), (p) => !IsBusy);
            RefreshAlianceRankingsCmd = new SimpleCommand(this, (p) => DoRefreshAlianceRankingsCmd(), (p) => !IsBusy);
            RefreshAliancePlotCmd     = new SimpleCommand(this, (p) => DoRefreshAliancePlotCmd(), (p) => !IsBusy);

            EmpireRankings        = new ObservableCollection <CurrentEmpireRanking>();
            EmpireHistRanking     = new ObservableCollection <EmpireScoreHistory>();
            AlianceRankingHistory = new ObservableCollection <AlianceScoreHistory>();
            AlianceRankings       = new ObservableCollection <CurrentAlianceRanking>();

            if (IoCHelper.IsInitialized)
            {
                Db = IoCHelper.GetIoC().Resolve <Database>();
            }
        }
Beispiel #16
0
        public MainWindow()
        {
            InitializeComponent();
            AllowsTransparency = false;

            if (IoCHelper.IsInitialized)
            {
                //webBrowser.RequestHandler = new RequestHandler();
                var mv = IoCHelper.GetIoC().Resolve <MainWindowMV>();
                DataContext = mv;

                var jsInt   = IoCHelper.GetIoC().Resolve <JScriptInterface>();
                var browser = new ChromiumWebBrowser(mv.Url);
                jsInt.InitBrowser(browser);
                mv.Browser   = browser;
                wfHost.Child = browser;
            }
        }
Beispiel #17
0
        async private void DoRefreshRankingsCmd()
        {
            var get = IoCHelper.GetIoC().Resolve <GetEmpireRanking>();

            get.Continent = EmpireContinentFilter;

            IsBusy = true;

            try
            {
                await Task.Run(() => Db.ExecuteWork(get));

                if (get.Result != null)
                {
                    m_RankingsCache = get.Result;
                    DoFilter();
                }
            }
            finally
            {
                IsBusy = false;
            }
        }
Beispiel #18
0
        public MainWindowMV()
        {
            //TestCmd = new SimpleCommand(this, (p) => DoRefreshPlayerName(), (p) => !IsBusy);

            if (IoCHelper.IsInitialized)
            {
                Url       = @"https://www.crownofthegods.com";
                m_SyncCtx = SynchronizationContext.Current;

                string path = (AppDomain.CurrentDomain.GetData("DataDirectory") as string ?? "");

                if (!string.IsNullOrWhiteSpace(path))
                {
                    path += @"\";
                }

                MainWindowTitle = "CotGBrowser, " + Assembly.GetExecutingAssembly().GetName().Version.ToString();

                JSInterface = IoCHelper.GetIoC().Resolve <JScriptInterface>();

                m_Timer          = new DispatcherTimer();
                m_Timer.Tick    += M_Timer_Tick;
                m_Timer.Interval = new TimeSpan(0, 0, 5);
                m_Timer.Start();

                NavigateCmd     = new SimpleCommand(this, (p) => DoNavigateCmd(), (p) => !IsBusy);
                ShowRankingsCmd = new SimpleCommand(this, (p) => DoShowRankingsCmd(), (p) => !IsBusy && HasAccess2Reports);
                ShowMenuCmd     = new SimpleCommand(this, (p) => DoShowMenuCmd());

                ShowDataCollectCmd = new SimpleCommand(this, (p) => DoShowDataCollectCmd(), (p) => !IsBusy && !string.IsNullOrWhiteSpace(PlayerName));

                ShowChatCmd      = new SimpleCommand(this, (p) => DoShowChatCmd(), (p) => !IsBusy && !string.IsNullOrWhiteSpace(PlayerName));
                ClearCacheCmd    = new SimpleCommand(this, (p) => DoClearCacheCmd());
                ShowOverviewsCmd = new SimpleCommand(this, (p) => DoShowOverviewsCmd(), (p) => !IsBusy && !string.IsNullOrWhiteSpace(PlayerName));
            }
        }
Beispiel #19
0
        public ChatWindowMV()
        {
            m_IsWorldVisible   = true;
            m_IsAllyVisible    = true;
            m_IsOfficerVisible = true;
            m_IsWhisperVisible = true;
            m_Out2Ally         = true;
            m_Out2Officers     = false;
            m_Out2World        = false;
            m_AutoScroll       = true;
            m_IsWhisperMode    = false;
            m_IsOfficer        = true;
            m_WndState         = WindowState.Normal;

            if (IoCHelper.IsInitialized)
            {
                Notify = IoCHelper.GetIoC().Resolve <CotGNotifyIcon>();

                ChatDoc             = new FlowDocument();
                ChatDoc.PagePadding = new Thickness(1);

                m_ChatP            = new Paragraph();
                m_ChatP.FontFamily = new FontFamily("Segoe UI");
                m_ChatP.FontSize   = 13.333;
                ChatDoc.Blocks.Add(m_ChatP);

                JSInterface = IoCHelper.GetIoC().Resolve <JScriptInterface>();
                JSInterface.InitChat();
                JSInterface.ChatMessage      += JSInterface_ChatMessage;
                JSInterface.ChatInputChanged += JSInterface_ChatInputChanged;

                IsOfficer = JSInterface.IsOfficer();

                ReloadMessages();
            }
        }
Beispiel #20
0
        public UCRaidReportMV()
        {
            if (IoCHelper.IsInitialized)
            {
                JSInterface = IoCHelper.GetIoC().Resolve <JScriptInterface>();
                JSInterface.CurrentRaidReport += JSInterface_CurrentRaidReport;
            }

            CapacityReserve = 15;
            CalcTroops      = new ObservableCollection <RaidCalcTroopData>();

            CalcTroops.Add(new RaidCalcTroopData()
            {
                TroopName    = "Vanquisher",
                LootCapacity = 10,
                Weight       = 0,
                OptimalQty   = 0,
                TropType     = "5"
            });

            CalcTroops.Add(new RaidCalcTroopData()
            {
                TroopName    = "Triari",
                LootCapacity = 20,
                Weight       = 0,
                OptimalQty   = 0,
                TropType     = "3"
            });

            CalcTroops.Add(new RaidCalcTroopData()
            {
                TroopName    = "Ranger",
                LootCapacity = 10,
                Weight       = 0,
                OptimalQty   = 0,
                TropType     = "2"
            });

            CalcTroops.Add(new RaidCalcTroopData()
            {
                TroopName    = "Praetor",
                LootCapacity = 20,
                Weight       = 0,
                OptimalQty   = 0,
                TropType     = "9"
            });

            CalcTroops.Add(new RaidCalcTroopData()
            {
                TroopName    = "Arbalist",
                LootCapacity = 15,
                Weight       = 0,
                OptimalQty   = 0,
                TropType     = "8"
            });

            CalcTroops.Add(new RaidCalcTroopData()
            {
                TroopName    = "Horseman",
                LootCapacity = 15,
                Weight       = 0,
                OptimalQty   = 0,
                TropType     = "10"
            });

            CalcTroops.Add(new RaidCalcTroopData()
            {
                TroopName    = "Sorcerer",
                LootCapacity = 5,
                Weight       = 0,
                OptimalQty   = 0,
                TropType     = "6"
            });

            CalcTroops.Add(new RaidCalcTroopData()
            {
                TroopName    = "Druid",
                LootCapacity = 10,
                Weight       = 0,
                OptimalQty   = 0,
                TropType     = "11"
            });

            CalcTroops.Add(new RaidCalcTroopData()
            {
                TroopName    = "Priestess",
                LootCapacity = 10,
                Weight       = 0,
                OptimalQty   = 0,
                TropType     = "4"
            });

            foreach (var ct in CalcTroops)
            {
                ct.PropertyChanged += (s, e) => CalcOptimalSquad();
            }
        }
Beispiel #21
0
        private void DoShowRankingsCmd()
        {
            var wnd = IoCHelper.GetIoC().Resolve <RankingsWindow>();

            wnd.Show();
        }
Beispiel #22
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);
            log4net.Config.XmlConfigurator.Configure();
            m_Log = LogManager.GetLogger(this.GetType());

            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;

            var tmpFolder = System.IO.Path.GetTempPath() + "CotgBrowser_Cache";

            if (CotGBrowser.Properties.Settings.Default.ClearCache)
            {
                var dirInfo = new System.IO.DirectoryInfo(tmpFolder);

                foreach (System.IO.FileInfo file in dirInfo.GetFiles())
                {
                    file.Delete();
                }

                CotGBrowser.Properties.Settings.Default.ClearCache = false;
                CotGBrowser.Properties.Settings.Default.Save();
            }

            var settings = new CefSettings();

            settings.CachePath = tmpFolder;
            //settings.CefCommandLineArgs.Clear();
            settings.RemoteDebuggingPort = 8088;
            settings.CefCommandLineArgs.Add("enable-crash-reporter", "1");
            settings.CefCommandLineArgs.Add("proxy-auto-detect", "1");

            //single_process
            //settings.CefCommandLineArgs.Add("single_process", "1");
            //settings.CefCommandLineArgs.Add("renderer-process-limit", "1");

            //WPF opt
            settings.WindowlessRenderingEnabled = true;
            settings.EnableInternalPdfViewerOffScreen();
            //settings.CefCommandLineArgs.Add("disable-gpu", "1");
            settings.CefCommandLineArgs.Add("disable-gpu-compositing", "1");
            //settings.CefCommandLineArgs.Add("enable-begin-frame-scheduling", "1");

            //settings.CefCommandLineArgs.Add("enable-logging", "v=1");

            //settings.CefCommandLineArgs.Add("js-flags", "--max-old-space-size=2000");

            //settings.CefCommandLineArgs.Add("renderer-startup-dialog", "1");
            //settings.CefCommandLineArgs.Add("disable-gpu-vsync", "1");
            //settings.CefCommandLineArgs.Add("disable-canvas-aa", "1");
            //settings.CefCommandLineArgs.Add("disable-gpu-rasterization", "1");

            settings.MultiThreadedMessageLoop  = true;
            settings.FocusedNodeChangedEnabled = true;
            settings.LogSeverity = LogSeverity.Error;

            Cef.OnContextInitialized = delegate
            {
                var cookieManager = Cef.GetGlobalCookieManager();
                cookieManager.SetStoragePath("cookies", true);

                //Dispose of context when finished - preferable not to keep a reference if possible.
                using (var context = Cef.GetGlobalRequestContext())
                {
                    string errorMessage;
                    //You can set most preferences using a `.` notation rather than having to create a complex set of dictionaries.
                    //The default is true, you can change to false to disable
                    context.SetPreference("webkit.webprefs.plugins_enabled", true, out errorMessage);
                }
            };

            if (!Cef.Initialize(settings, shutdownOnProcessExit: true, performDependencyCheck: false))
            {
                throw new Exception("Unable to Initialize Cef");
            }

            /*
             * Task.Run(() =>
             * {
             *  while (true)
             *  {
             *      try
             *      {
             *          //Application.Current.Dispatcher.Invoke(new Action(
             *          //  () => Cef.DoMessageLoopWork()));
             *          Cef.DoMessageLoopWork();
             *          System.Threading.Thread.Sleep(100);
             *      }
             *      catch (Exception eml)
             *      {
             *          m_Log.Error(eml.Message, eml);
             *      }
             *  }
             * });
             */

            //konf. fabryki
            IoCHelper.GetIoC();

            Mapper.Initialize(cfg =>
            {
                cfg.AddProfile <GotGLib.NH.Schema.MapperProfile>();
            });
            Mapper.AssertConfigurationIsValid();

            m_Log.Info("Application started.");

            Application.Current.MainWindow = IoCHelper.GetIoC().Resolve <Views.MainWindow>();
            Application.Current.MainWindow.Show();
            Application.Current.ShutdownMode = ShutdownMode.OnMainWindowClose;

            CotGNotifyIcon notify = new CotGNotifyIcon();

            IoCHelper.GetIoC().RegisterInstance <CotGNotifyIcon>(notify, new ContainerControlledLifetimeManager());
            notify.AppStarted();
        }
Beispiel #23
0
 private void DoShowOverviewsCmd()
 {
     IoCHelper.GetIoC().Resolve <OverviewsWindow>().Show();
 }