private void Draw(RectangleF rcClip) { if (m_gOff != null) { if (m_arPageButton.Count <= 0) { CalculateLayout(m_gOff); } StringFormat sf = new StringFormat(); sf.LineAlignment = StringAlignment.Center; sf.Alignment = StringAlignment.Center; for (int i = 0; i < m_arPageButton.Count; ++i) { PageButton pb = (PageButton)m_arPageButton[i]; if (pb.Rect.IntersectsWith(rcClip)) { // Draw Background m_gOff.FillRectangle(GetButtonBrush(pb), pb.Rect); // Draw Border m_gOff.DrawLines(GetButtonPen(pb), pb.RoundRect); // Draw Text if (pb.Active) { m_gOff.DrawString(pb.Text, new Font(this.Font, FontStyle.Bold), GetButtonTextBrush(pb), pb.Rect, sf); } else { m_gOff.DrawString(pb.Text, this.Font, GetButtonTextBrush(pb), pb.Rect, sf); } } } } }
private void _handlePlayerPagePressed(PageButton buttonPressed) { if (m_selectedPages.Count < m_maxPlayerPages) { buttonPressed.transform.SetParent(m_playerTradePagesRect.content, false); buttonPressed.MenuId = m_selectedPlayerPageId; m_selectedPages.Add(buttonPressed); } }
private void EndScreen() { var settings = new PageButton(GraphicsDevice, new Vector2(200, 160), new Point(400, 50), Color.LightGreen, "Main Menu", this, "MainMenu.ss", 1); var exitButton = new ExitButton(GraphicsDevice, new Vector2(200, 230), new Point(400, 50), Color.LightGreen, "Exit", this); settings.Scale = 1; exitButton.Scale = 1; canv.AddComponent(settings); canv.AddComponent(exitButton); ss.SaveStyleSheet(canv.Components, "EndScreen.ss"); canv.RemoveAllComponents(); }
private void ButtunPage(int total) { int totalPage = total; List <Models.PageButton> ListBtn = new List <PageButton>(); PageButton t; for (int i = 0; i < totalPage; i++) { t = new PageButton(); t.I = i + 1; ListBtn.Add(t); } ListButton.ItemsSource = ListBtn; }
private void btnNumber_Click(object sender, RoutedEventArgs e) { Button temp = sender as Button; PageButton D = temp.DataContext as PageButton; int Id = D.I; var db = this.FindResource("dbForWd") as Models.Page; ListButton.SelectedIndex = Id - 1; int totalPage; db.CurPage = Id; db.Products = GetSearchQuery(db.CurPage, Models.Page.PageSize, out totalPage); db.TotalPage = totalPage; }
private void SettingsPage() { int y = 60; for (int i = 0; i < Enum.GetNames(typeof(Controls)).Length; i++) { y += 37; InputButton input = new InputButton(GraphicsDevice, new Vector2(400, y), new Point(200, 32), Color.LightGreen, inputDef.GetControls((Controls)i), this, (Controls)i, inputDef); Label label = new Label(new Vector2(250, y + (input.Size.Y / 2)), ((Controls)i).ToString(), Color.Black); canv.AddComponent(label); canv.AddComponent(input); } PageButton MainMenu = new PageButton(GraphicsDevice, new Vector2(270, y + 37), new Point(200, 32), Color.LightGreen, "Main Menu", this, "MainMenu.ss", 0); canv.AddComponent(MainMenu); ss.SaveStyleSheet(canv.Components, "SettingsPage.ss"); canv.RemoveAllComponents(); }
public override void PageButtonPressed(PageButton buttonPressed) { BaseStorybookGame gameManager = GameManager.GetInstance<BaseStorybookGame>(); PageData pageData = buttonPressed.PageData; if (pageData.InventoryId < gameManager.DeckSize) { if (m_selectedDeckPage != null) { m_selectedDeckPage.DisplaySelectedImage(false); } if (m_selectedDeckPage == buttonPressed) { m_selectedDeckPage.DisplaySelectedImage(false); m_selectedDeckPage = null; } else { m_selectedDeckPage = buttonPressed; m_selectedDeckPage.DisplaySelectedImage(true); } } else { if (m_selectedInventoryPage != null) { m_selectedInventoryPage.DisplaySelectedImage(false); } if (m_selectedInventoryPage == buttonPressed) { m_selectedInventoryPage.DisplaySelectedImage(false); m_selectedInventoryPage = null; } else { m_selectedInventoryPage = buttonPressed; m_selectedInventoryPage.DisplaySelectedImage(true); } } _checkForSwap(); }
public override void PageButtonPressed(PageButton pageButton) { if (m_selectedPage != null) { m_selectedPage.DisplaySelectedImage(false); } if (pageButton == m_selectedPage) { m_selectedPage = null; m_submitButton.interactable = false; } else { m_selectedPage = pageButton; pageButton.DisplaySelectedImage(true); m_submitButton.interactable = true; } }
public override void PageButtonPressed(PageButton pageButton) { Debug.Log("Page button pressed"); switch (pageButton.MenuId) { case m_playerInventoryMenuId: _handlePlayerPagePressed(pageButton); break; case m_shopInventoryMenuId: _handleShopPagePressed(pageButton); break; case m_selectedPlayerPageId: _handleSelectedPlayerPagePressed(pageButton); break; case m_selectedShopPageId: _handleSelectedShopPagePressed(pageButton); break; } }
/// <summary> /// When a page button is pressed in this menu, that page becomes the current selected page and is displayed /// underneath the 'selected page' label /// </summary> /// <param name="buttonPressed">The page button that was pressed</param> public override void PageButtonPressed(PageButton buttonPressed) { if (m_pageButtonInScroll != null) { m_pageButtonInScroll.DisplaySelectedImage(false); } m_pageButtonInScroll = buttonPressed; buttonPressed.DisplaySelectedImage(true); Button selectedButton = _initializePageButton(buttonPressed.PageData); selectedButton.enabled = false; RectTransform[] AllRects = GetComponentsInChildren<RectTransform>(); RectTransform selectedPageRect = null; // Find the selected page rect foreach(RectTransform rectT in AllRects) { if (rectT.name == "SelectedPage") { selectedPageRect = rectT; break; } } // If there was a previously selected page, destroy it in the UI if (m_selectedButton != null) { Destroy(selectedPageRect.GetChild(0).gameObject); } GridLayoutGroup grid = selectedPageRect.GetComponent<GridLayoutGroup>(); grid.cellSize = new Vector2(m_buttonWidth, m_buttonHeight); selectedButton.transform.SetParent(selectedPageRect.transform, false); m_selectedButton = selectedButton; m_selectedPageButton = selectedButton.GetComponent<PageButton>(); m_submitPageButton.enabled = true; }
private Brush GetButtonBrush(PageButton pb) { if (pb.Active && pb.State != ButtonState.Hilight) { return(m_brBgActive); } else { switch (pb.State) { case ButtonState.Hilight: return(m_brBgHilight); case ButtonState.Normal: return(m_brBgNormal); case ButtonState.Disable: return(m_brBgDisable); default: return(m_brBgNormal); } } }
private Pen GetButtonPen(PageButton pb) { if (pb.Active && pb.State != ButtonState.Hilight) { return(m_penBorder); } else { switch (pb.State) { case ButtonState.Hilight: return(m_penBorder); case ButtonState.Normal: return(m_penBorder); case ButtonState.Disable: return(SystemPens.ControlDark); default: return(m_penBorder); } } }
private Brush GetButtonTextBrush(PageButton pb) { if (pb.Active && pb.State != ButtonState.Hilight) { return(m_brText); } else { switch (pb.State) { case ButtonState.Hilight: return(m_brText); case ButtonState.Normal: return(m_brText); case ButtonState.Disable: return(SystemBrushes.ControlDark); default: return(m_brText); } } }
/// <summary> /// 设计器支持所需的方法 - 不要 /// 使用代码编辑器修改此方法的内容。 /// </summary> private void InitializeComponent() { this.btnLastPage = new System.Windows.Forms.Label(); this.btnNextPage = new System.Windows.Forms.Label(); this.btnPrePage = new System.Windows.Forms.Label(); this.btnFirstPage = new System.Windows.Forms.Label(); this.btnNextGroup = new PageButton(); this.btnPreGroup = new PageButton(); this.pageButton10 = new PageButton(); this.pageButton9 = new PageButton(); this.pageButton8 = new PageButton(); this.pageButton7 = new PageButton(); this.pageButton6 = new PageButton(); this.pageButton5 = new PageButton(); this.pageButton4 = new PageButton(); this.pageButton3 = new PageButton(); this.pageButton2 = new PageButton(); this.pageButton1 = new PageButton(); this.SuspendLayout(); // // btnLastPage // this.btnLastPage.Cursor = System.Windows.Forms.Cursors.Hand; this.btnLastPage.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnLastPage.Location = new System.Drawing.Point(505, 8); this.btnLastPage.Name = "btnLastPage"; this.btnLastPage.Size = new System.Drawing.Size(30, 23); this.btnLastPage.TabIndex = 23; this.btnLastPage.Text = "末页"; this.btnLastPage.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.btnLastPage.Click += new System.EventHandler(this.btnLastPage_Click); this.btnLastPage.MouseLeave += new System.EventHandler(this.btnFirstPage_MouseLeave); this.btnLastPage.MouseHover += new System.EventHandler(this.btnFirstPage_MouseHover); // // btnNextPage // this.btnNextPage.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnNextPage.Location = new System.Drawing.Point(462, 8); this.btnNextPage.Name = "btnNextPage"; this.btnNextPage.Size = new System.Drawing.Size(42, 23); this.btnNextPage.TabIndex = 22; this.btnNextPage.Text = "下一页"; this.btnNextPage.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.btnNextPage.Click += new System.EventHandler(this.btnNextPage_Click); this.btnNextPage.MouseLeave += new System.EventHandler(this.btnFirstPage_MouseLeave); this.btnNextPage.MouseHover += new System.EventHandler(this.btnFirstPage_MouseHover); // // btnPrePage // this.btnPrePage.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnPrePage.Location = new System.Drawing.Point(46, 8); this.btnPrePage.Name = "btnPrePage"; this.btnPrePage.Size = new System.Drawing.Size(42, 23); this.btnPrePage.TabIndex = 21; this.btnPrePage.Text = "上一页"; this.btnPrePage.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.btnPrePage.Click += new System.EventHandler(this.btnPrePage_Click); this.btnPrePage.MouseLeave += new System.EventHandler(this.btnFirstPage_MouseLeave); this.btnPrePage.MouseHover += new System.EventHandler(this.btnFirstPage_MouseHover); // // btnFirstPage // this.btnFirstPage.Cursor = System.Windows.Forms.Cursors.Hand; this.btnFirstPage.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnFirstPage.Location = new System.Drawing.Point(15, 8); this.btnFirstPage.Name = "btnFirstPage"; this.btnFirstPage.Size = new System.Drawing.Size(30, 23); this.btnFirstPage.TabIndex = 20; this.btnFirstPage.Text = "首页"; this.btnFirstPage.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.btnFirstPage.Click += new System.EventHandler(this.btnFirstPage_Click); this.btnFirstPage.MouseLeave += new System.EventHandler(this.btnFirstPage_MouseLeave); this.btnFirstPage.MouseHover += new System.EventHandler(this.btnFirstPage_MouseHover); // // btnNextGroup // this.btnNextGroup.BackColor = System.Drawing.Color.Transparent; this.btnNextGroup.Cursor = System.Windows.Forms.Cursors.Default; this.btnNextGroup.Location = new System.Drawing.Point(431, 8); this.btnNextGroup.Name = "btnNextGroup"; this.btnNextGroup.Size = new System.Drawing.Size(25, 23); this.btnNextGroup.TabIndex = 35; this.btnNextGroup.Text = "..."; this.btnNextGroup.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.btnNextGroup.Click += new System.EventHandler(this.btnNextGroup_Click); // // btnPreGroup // this.btnPreGroup.BackColor = System.Drawing.Color.Transparent; this.btnPreGroup.Cursor = System.Windows.Forms.Cursors.Default; this.btnPreGroup.Location = new System.Drawing.Point(90, 8); this.btnPreGroup.Name = "btnPreGroup"; this.btnPreGroup.Size = new System.Drawing.Size(25, 23); this.btnPreGroup.TabIndex = 34; this.btnPreGroup.Text = "..."; this.btnPreGroup.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.btnPreGroup.Click += new System.EventHandler(this.btnPreGroup_Click); // // pageButton10 // this.pageButton10.BackColor = System.Drawing.Color.Transparent; this.pageButton10.Cursor = System.Windows.Forms.Cursors.Default; this.pageButton10.Location = new System.Drawing.Point(400, 8); this.pageButton10.Name = "pageButton10"; this.pageButton10.Size = new System.Drawing.Size(25, 23); this.pageButton10.TabIndex = 33; this.pageButton10.Text = "10"; this.pageButton10.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // // pageButton9 // this.pageButton9.BackColor = System.Drawing.Color.Transparent; this.pageButton9.Cursor = System.Windows.Forms.Cursors.Default; this.pageButton9.Location = new System.Drawing.Point(369, 8); this.pageButton9.Name = "pageButton9"; this.pageButton9.Size = new System.Drawing.Size(25, 23); this.pageButton9.TabIndex = 32; this.pageButton9.Text = "9"; this.pageButton9.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // // pageButton8 // this.pageButton8.BackColor = System.Drawing.Color.Transparent; this.pageButton8.Cursor = System.Windows.Forms.Cursors.Default; this.pageButton8.Location = new System.Drawing.Point(338, 8); this.pageButton8.Name = "pageButton8"; this.pageButton8.Size = new System.Drawing.Size(25, 23); this.pageButton8.TabIndex = 31; this.pageButton8.Text = "8"; this.pageButton8.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // // pageButton7 // this.pageButton7.BackColor = System.Drawing.Color.Transparent; this.pageButton7.Cursor = System.Windows.Forms.Cursors.Default; this.pageButton7.Location = new System.Drawing.Point(307, 8); this.pageButton7.Name = "pageButton7"; this.pageButton7.Size = new System.Drawing.Size(25, 23); this.pageButton7.TabIndex = 30; this.pageButton7.Text = "7"; this.pageButton7.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // // pageButton6 // this.pageButton6.BackColor = System.Drawing.Color.Transparent; this.pageButton6.Cursor = System.Windows.Forms.Cursors.Default; this.pageButton6.Location = new System.Drawing.Point(276, 8); this.pageButton6.Name = "pageButton6"; this.pageButton6.Size = new System.Drawing.Size(25, 23); this.pageButton6.TabIndex = 29; this.pageButton6.Text = "6"; this.pageButton6.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // // pageButton5 // this.pageButton5.BackColor = System.Drawing.Color.Transparent; this.pageButton5.Cursor = System.Windows.Forms.Cursors.Default; this.pageButton5.Location = new System.Drawing.Point(245, 8); this.pageButton5.Name = "pageButton5"; this.pageButton5.Size = new System.Drawing.Size(25, 23); this.pageButton5.TabIndex = 28; this.pageButton5.Text = "5"; this.pageButton5.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // // pageButton4 // this.pageButton4.BackColor = System.Drawing.Color.Transparent; this.pageButton4.Cursor = System.Windows.Forms.Cursors.Default; this.pageButton4.Location = new System.Drawing.Point(214, 8); this.pageButton4.Name = "pageButton4"; this.pageButton4.Size = new System.Drawing.Size(25, 23); this.pageButton4.TabIndex = 27; this.pageButton4.Text = "4"; this.pageButton4.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // // pageButton3 // this.pageButton3.BackColor = System.Drawing.Color.Transparent; this.pageButton3.Cursor = System.Windows.Forms.Cursors.Default; this.pageButton3.Location = new System.Drawing.Point(183, 8); this.pageButton3.Name = "pageButton3"; this.pageButton3.Size = new System.Drawing.Size(25, 23); this.pageButton3.TabIndex = 26; this.pageButton3.Text = "3"; this.pageButton3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // // pageButton2 // this.pageButton2.BackColor = System.Drawing.Color.Transparent; this.pageButton2.Cursor = System.Windows.Forms.Cursors.Default; this.pageButton2.Location = new System.Drawing.Point(152, 8); this.pageButton2.Name = "pageButton2"; this.pageButton2.Size = new System.Drawing.Size(25, 23); this.pageButton2.TabIndex = 25; this.pageButton2.Text = "2"; this.pageButton2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // // pageButton1 // this.pageButton1.BackColor = System.Drawing.Color.Transparent; this.pageButton1.Cursor = System.Windows.Forms.Cursors.Default; this.pageButton1.Location = new System.Drawing.Point(121, 8); this.pageButton1.Name = "pageButton1"; this.pageButton1.Size = new System.Drawing.Size(25, 23); this.pageButton1.TabIndex = 24; this.pageButton1.Text = "1"; this.pageButton1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // // WinFormPager // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(this.btnNextGroup); this.Controls.Add(this.btnPreGroup); this.Controls.Add(this.pageButton10); this.Controls.Add(this.pageButton9); this.Controls.Add(this.pageButton8); this.Controls.Add(this.pageButton7); this.Controls.Add(this.pageButton6); this.Controls.Add(this.pageButton5); this.Controls.Add(this.pageButton4); this.Controls.Add(this.pageButton3); this.Controls.Add(this.pageButton2); this.Controls.Add(this.pageButton1); this.Controls.Add(this.btnLastPage); this.Controls.Add(this.btnNextPage); this.Controls.Add(this.btnPrePage); this.Controls.Add(this.btnFirstPage); this.Name = "WinFormPager"; this.Size = new System.Drawing.Size(569, 37); this.ResumeLayout(false); }
private void CalculateLayout(Graphics g) { m_arPageButton = new ArrayList(); float fMaxWidth = -1; int iStartPage = MIN_PAGE; int iEndPage = m_iMaxPage; if (m_iMaxPage > m_iPagePerScreen) { iStartPage = m_iCurrentPage - (m_iPagePerScreen / 2); iEndPage = iStartPage + m_iPagePerScreen - 1; if (iStartPage < 1) { iEndPage += (1 - iStartPage); iStartPage = 1; } else if (iEndPage > m_iMaxPage) { iStartPage -= (iEndPage - m_iMaxPage); iEndPage = m_iMaxPage; } } // Total Page PageButton pTotal = new PageButton(g, this.Font, this.ClientRectangle.Height, -1, string.Format("{0:#,##0} {1}", m_iMaxPage, m_strPageText)); pTotal.Location = new PointF(0, 0); m_arPageButton.Add(pTotal); // First Button PageButton pFirst = new PageButton(g, this.Font, this.ClientRectangle.Height, MIN_PAGE, CHAR_FIRST); fMaxWidth = GetMax(fMaxWidth, pFirst.Rect.Width); pFirst.State = (iStartPage > MIN_PAGE) ? ButtonState.Normal : ButtonState.Disable; m_arPageButton.Add(pFirst); // Prev Button PageButton pPrev = new PageButton(g, this.Font, this.ClientRectangle.Height, m_iCurrentPage - 1, CHAR_PREV); fMaxWidth = GetMax(fMaxWidth, pPrev.Rect.Width); pPrev.State = (m_iCurrentPage > MIN_PAGE) ? ButtonState.Normal : ButtonState.Disable; m_arPageButton.Add(pPrev); // Page Navigator for (int i = iStartPage; i <= iEndPage; ++i) { PageButton pButton = new PageButton(g, this.Font, this.ClientRectangle.Height, i, string.Format("{0:#,##0}", i)); fMaxWidth = GetMax(fMaxWidth, pButton.Rect.Width); pButton.Active = (m_iCurrentPage == i); m_arPageButton.Add(pButton); } // Next Button PageButton pNext = new PageButton(g, this.Font, this.ClientRectangle.Height, m_iCurrentPage + 1, CHAR_NEXT); fMaxWidth = GetMax(fMaxWidth, pNext.Rect.Width); pNext.State = (m_iCurrentPage < m_iMaxPage) ? ButtonState.Normal : ButtonState.Disable; m_arPageButton.Add(pNext); // Last Button PageButton pLast = new PageButton(g, this.Font, this.ClientRectangle.Height, m_iMaxPage, CHAR_LAST); fMaxWidth = GetMax(fMaxWidth, pLast.Rect.Width); pLast.State = (iEndPage < m_iMaxPage) ? ButtonState.Normal : ButtonState.Disable; m_arPageButton.Add(pLast); // Update Width & Location float fx = 0; switch (m_alignment) { case StringAlignment.Near: pTotal.Location = new PointF(0, 0); fx += pTotal.Width + SPACE; for (int i = 1; i < m_arPageButton.Count; ++i) { ((PageButton)m_arPageButton[i]).Width = fMaxWidth; ((PageButton)m_arPageButton[i]).Location = new PointF(fx, 0); fx += fMaxWidth + SPACE; } break; case StringAlignment.Center: float fTotalWidth = pTotal.Width + SPACE; fTotalWidth += (m_arPageButton.Count - 1) * (fMaxWidth + SPACE); fx = (this.ClientRectangle.Width - fTotalWidth) / 2; pTotal.Location = new PointF(fx, 0); fx += pTotal.Width + SPACE; for (int i = 1; i < m_arPageButton.Count; ++i) { ((PageButton)m_arPageButton[i]).Width = fMaxWidth; ((PageButton)m_arPageButton[i]).Location = new PointF(fx, 0); fx += fMaxWidth + SPACE; } break; case StringAlignment.Far: fx = this.ClientRectangle.Width; pTotal.Location = new PointF(fx - pTotal.Width - 1, 0); fx -= pTotal.Width + SPACE; for (int i = m_arPageButton.Count - 1; i > 0; --i) { ((PageButton)m_arPageButton[i]).Width = fMaxWidth; fx -= ((PageButton)m_arPageButton[i]).Width + SPACE; ((PageButton)m_arPageButton[i]).Location = new PointF(fx, 0); fx -= SPACE; } break; } }
public void LoadData(DataRow row) { txtF_AccidentName.Text = row["F_AccidentName"].ToString(); txtF_Description.Text = row["F_Description"].ToString(); txtF_AccidentDate.Text = DateTime.Parse(row["F_AccidentDate"].ToString()).ToString("yyyy年MM月dd日"); txtF_OperateTime.Text = row["F_OperatorName"].ToString(); string id = row["F_ID"].ToString(); List <Library.Model.UploadImages> modellist = SystemManager.Instance.Services.UploadImagesService.GetModelList("F_AccidentID=" + id + " and F_IsDelete=0"); int index = 0; foreach (Library.Model.UploadImages image in modellist) { index++; PageButton btn = new PageButton(); btn.PageIndex = index.ToString(); btn.Obj = image; btn.Margin = new Thickness(5, 0, 0, 0); btn.MouseLeftButtonDown += (sender, e) => { try { SplashScreenHelper.Instance.ShowSplashScreen(); PageButton btntemp = sender as PageButton; string uri = "http://" + ConfigurationManager.AppSettings["httpurl"] + "/uploadimages/" + (btntemp.Obj as UploadImages).F_ImagePath; WebClient wc = new WebClient(); using (var ms = new MemoryStream(wc.DownloadData(uri))) { BitmapImage image1 = new BitmapImage(); image1.BeginInit(); image1.CacheOption = BitmapCacheOption.OnLoad; image1.StreamSource = ms; image1.EndInit(); img.Source = image1; } Point centerPoint = e.GetPosition(root); this.sfr.CenterX = centerPoint.X; this.sfr.CenterY = centerPoint.Y; sfr.ScaleX = 1; sfr.ScaleY = 1; } finally { SplashScreenHelper.Instance.HideSplashScreen(); } }; BtnPanels.Children.Add(btn); ll.Add(btn); } if (ll.Count > 0) { // string s = "http://" + ConfigurationManager.AppSettings["httpurl"] + "/uploadimages/" + (ll[0].Obj as UploadImages).F_ImagePath; // img.Source = new BitmapImage(new Uri(s)); string uri = "http://" + ConfigurationManager.AppSettings["httpurl"] + "/uploadimages/" + (ll[0].Obj as UploadImages).F_ImagePath; WebClient wc = new WebClient(); try { using (var ms = new MemoryStream(wc.DownloadData(uri))) { BitmapImage image = new BitmapImage(); image.BeginInit(); image.CacheOption = BitmapCacheOption.OnLoad; image.StreamSource = ms; image.EndInit(); img.Source = image; } } catch (Exception ex) { MessageBox.Show("照片丢失!" + ex.Message); } } }
// Send the page data to the combat system which will process the move, but only if the player is thinking public override void PageButtonPressed(PageButton pageButton) { // Send PageData to the combat system if (m_isThinking) { if (m_selectedPageButton != null) { m_selectedPageButton.DisplaySelectedImage(false); } m_selectedPageButton = pageButton; pageButton.DisplaySelectedImage(true); _hideEnemyTargetButtons(); _hidePlayerTargetButtons(); m_handId = m_pageButtonList.IndexOf(pageButton); _displayTargetButtons(pageButton); if (pageButton.PageData.IsRare) { m_selectedMoveTargets = 4; } else { m_selectedMoveTargets = 1; } } return; }
private void _displayTargetButtons(PageButton buttonPressed) { switch (buttonPressed.PageMoveType) { case MoveType.Attack: _displayEnemyTargetButtons(); break; case MoveType.Boost: _displayPlayerTargetButtons(); break; case MoveType.Status: _displayEnemyTargetButtons(); break; } }
private void _handleSelectedPlayerPagePressed(PageButton buttonPressed) { buttonPressed.transform.SetParent(m_playerInventoryPagesRect.content, false); buttonPressed.MenuId = m_playerInventoryMenuId; m_selectedPages.Remove(buttonPressed); }
private void _checkForSwap() { if (m_selectedDeckPage != null && m_selectedInventoryPage != null) { GameManager gameManager = FindObjectOfType<GameManager>(); PlayerInventory localInventory = gameManager.GetLocalPlayer<PlayerEntity>().OurInventory; localInventory.Move(m_selectedDeckPage.PageData.InventoryId, m_selectedInventoryPage.PageData.InventoryId); _swapPagesInMenu(); m_selectedInventoryPage = null; m_selectedDeckPage = null; } }
private void _handleShopPagePressed(PageButton buttonPressed) { if (!m_shopPageSelected) { buttonPressed.transform.SetParent(m_selectedShopPageRect, false); buttonPressed.MenuId = m_selectedShopPageId; m_shopPageSelected = true; m_selectedShopPageButton = buttonPressed; } }
/// <summary> /// Function that is called by a page button that is in the current UI /// </summary> /// <param name="pageButton">The page button that was pressed</param> public abstract void PageButtonPressed(PageButton pageButton);
private void _handleSelectedShopPagePressed(PageButton buttonPressed) { buttonPressed.transform.SetParent(m_shopPagesRect.content, false); buttonPressed.MenuId = m_shopInventoryMenuId; m_shopPageSelected = false; m_selectedShopPageButton = null; }