Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            AppGrandHotel app = AppGrandHotel.Instance;

            app.Title = "Grand Hotel";

            // Ajout des pages
            Page Accueil = new PageAccueil();

            app.AddPage(Accueil);

            Page Client = new PageClient();

            app.AddPage(Client);

            Page Facture = new Factures();

            app.AddPage(Facture);



            // Affichage de la page d'accueil
            app.NavigateTo(Accueil);

            app.NavigateTo(Client);

            app.NavigateTo(Facture);
        }
Ejemplo n.º 2
0
 public DomoClient(IDomoConfig config)
 {
     _config  = config;
     Datasets = new DatasetClient(_config);
     Groups   = new GroupClient(_config);
     Pages    = new PageClient(_config);
     Streams  = new StreamClient(_config);
     Users    = new UserClient(_config);
 }
Ejemplo n.º 3
0
        public CommerceService()
        {
            this._listClient      = ClientContext.Clients.CreateListClient();
            this._browseClient    = ClientContext.Clients.CreateBrowseClient();
            this._storeClient     = ClientContext.Clients.CreateStoreClient();
            this._cartClient      = ClientContext.Clients.CreateCartClient();
            this._orderClient     = ClientContext.Clients.CreateOrderClient();
            this._securityClient  = ClientContext.Clients.CreateSecurityClient();
            this._priceClient     = ClientContext.Clients.CreatePriceClient();
            this._marketingClient = ClientContext.Clients.CreateMarketingClient();
            this._inventoryClient = ClientContext.Clients.CreateInventoryClient();
            this._themeClient     = ClientContext.Clients.CreateThemeClient();
            this._pageClient      = ClientContext.Clients.CreatePageClient();
            this._reviewsClient   = ClientContext.Clients.CreateReviewsClient();

            _themesCacheStoragePath = ConfigurationManager.AppSettings["ThemeCacheFolder"];
            _pagesCacheStoragePath  = ConfigurationManager.AppSettings["PageCacheFolder"];

            this._viewLocator = new FileThemeViewLocator(HostingEnvironment.MapPath(_themesCacheStoragePath));

            this._cartHelper = new CartHelper(this);
        }
Ejemplo n.º 4
0
        public void ParsesCharacterAbilityMappings()
        {
            var client = new WebClientWrapper("http://finalfantasy.wikia.com/wiki/");
            var page   = new PageClient(client);

            var table = page.GetPageHtmlBySelector("/List_of_Final_Fantasy_IX_support_abilities", "table.FFIX");

            var parser   = new HtmlParser();
            var dataList = parser.ParseTable <AbilityData>(table);

            var sut      = new ParsingService();
            var mappings = sut.GetCharacterAbilityMappings(dataList);

            mappings.Count.ShouldBe(252);

            mappings.First().Ability.ShouldBe("Auto-Reflect");
            mappings.First().Character.ShouldBe("Zidane");
            mappings.First().AP.ShouldBe(95);

            mappings.Last().Ability.ShouldBe("Bandit");
            mappings.Last().Character.ShouldBe("Zidane");
            mappings.Last().AP.ShouldBe(40);
        }
Ejemplo n.º 5
0
        public void Parses_Ability_Data()
        {
            var client = new WebClientWrapper("http://finalfantasy.wikia.com/wiki/");
            var page   = new PageClient(client);

            var table = page.GetPageHtmlBySelector("/List_of_Final_Fantasy_IX_support_abilities", "table.FFIX");

            var parser   = new HtmlParser();
            var dataList = parser.ParseTable <AbilityData>(table);

            dataList.Count.ShouldBe(63);
            dataList.First().Name.ShouldBe("Auto-Reflect");
            dataList.First().Effect.ShouldContain("Reflect");
            dataList.First().Source.ShouldContain("Reflect Ring");
            dataList.First().CharacterMap.ShouldContain("Eiko");
            dataList.First().Stones.ShouldBe("15");

            dataList.Last().Name.ShouldBe("Bandit");
            dataList.Last().Effect.ShouldContain("Steal");
            dataList.Last().Effect.ShouldContain("item");
            dataList.Last().Source.ShouldContain("N-Kai Armlet");
            dataList.Last().CharacterMap.ShouldContain("Zidane");
            dataList.Last().Stones.ShouldBe("5");
        }
Ejemplo n.º 6
0
        public void GetPageHtmlString_returns_valid_html()
        {
            var sut = new PageClient(new WebClientWrapper("http://www.google.com/"));

            PageResponse <string> html = sut.GetPageHtmlString("/valid-page");
        }
Ejemplo n.º 7
0
        public static PageClient CreatePageClient(this CommerceClients source, string serviceUrl, string appId, string secretKey)
        {
            var client = new PageClient(new Uri(serviceUrl), appId, secretKey);

            return(client);
        }
Ejemplo n.º 8
0
        public static PageClient CreatePageClient(this CommerceClients source, string serviceUrl)
        {
            var client = new PageClient(new Uri(serviceUrl), source.CreateMessageProcessingHandler());

            return(client);
        }
Ejemplo n.º 9
0
 public static PageClient CreatePageClient(this CommerceClients source, string serviceUrl, string appId, string secretKey)
 {
     var client = new PageClient(new Uri(serviceUrl), appId, secretKey);
     return client;
 }
Ejemplo n.º 10
0
 public static PageClient CreatePageClient(this CommerceClients source, string serviceUrl)
 {
     var client = new PageClient(new Uri(serviceUrl), source.CreateMessageProcessingHandler());
     return client;
 }
Ejemplo n.º 11
0
        private async void invokeCapture()
        {
            try
            {
                if (!isCaptureError)
                {
                    captureBtn.Enabled = false;
                    captureBtn.Text    = "正在截图!";
                    captureBtn.Cursor  = Cursors.WaitCursor;
                }
                if (pageClien == null)
                {
                    pageClien = browser.GetBrowser().GetDevToolsClient().Page;
                }

                var result = await pageClien.CaptureScreenshotAsync();

                captureBtn.Cursor  = Cursors.Arrow;
                captureBtn.Enabled = true;
                captureBtn.Text    = "截图";

                if (result.Data != null)
                {
                    MemoryStream ms = new MemoryStream(result.Data);
                    ms.Write(result.Data, 0, result.Data.Length);
                    // pictureBox1.Image = Image.FromStream(ms);

                    if (isCustomCapture)
                    {
                        isCustomCapture           = false;
                        customeCaptureBtn.Enabled = true;
                        resizeWindow(previousWidth, previousHeight);
                        browser.ExecuteScriptAsync("javascript:void(document.getElementsByTagName('embed')[0].Zoom(500));");
                    }

                    SaveFileDialog dialog = new SaveFileDialog();
                    dialog.Filter = "PNG图片 (*.PNG)|*.PNG";
                    DialogResult dresult = dialog.ShowDialog();
                    if (dresult == DialogResult.OK)
                    {
                        string path = dialog.FileName;
                        try
                        {
                            File.WriteAllBytes(path, result.Data);
                            MessageBox.Show(path + "保存成功。文件大小:" + decimal.Round(
                                                decimal.Divide(decimal.Parse(result.Data.Length.ToString()), decimal.Parse("1048576")), 2) + "MB", "截图结果", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        catch (Exception e)
                        {
                            MessageBox.Show(path + "保存失败!错误信息:" + e.Message, "截图结果", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                }
            } catch (Exception e)
            {
                isCaptureError     = true;
                captureBtn.Cursor  = Cursors.Arrow;
                captureBtn.Enabled = true;
                captureBtn.Text    = "截图";
                MessageBox.Show("截图过程中出现了未知的错误:" + e.Message, "西一爱服 小花仙登录器", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }