private bool GetUISign_inCumulative(CReadPacket packet) { Dictionary <string, object> data = packet.data; int resolt = int.Parse(data["ret"].ToString()); if (resolt == 0) { playerData.GetInstance().singnData.Signed = (data["signed"].ToString()); //Control.ShowGUI(UIPanleID.UIWelfare); GoodsDataOperation.GetInstance().AddGoods(UISign_inData.Instance().DoodsID, UISign_inData.Instance().DoodsNum); } else { UIgoodstips.Instances.Setgoods(UISign_inData.Instance().ItemNode, UISign_inData.Instance().ID); Control.Show(UIPanleID.UIgoodstips); } return(true); }
public void toggleConsole() { if (!isConsoleShown) { _consoleBox.Show(); Line.Clear(); Line.GrabFocus(); _animationPlayer.PlayBackwards("fade"); Input.SetMouseMode(Input.MouseMode.Visible); } else { _animationPlayer.Play("fade"); Input.SetMouseMode(Input.MouseMode.Captured); } isConsoleShown = !isConsoleShown; }
public void ShowEditControl() { if (_TreeListView.FocusedItem == null) { return; } ListViewItem item = (ListViewItem)_TreeListView.EditedItem.Item; Rectangle rec = _TreeListView.EditedItem.ColumnIndex > 0 ? _TreeListView.GetSubItemRect(item.Index, _TreeListView.EditedItem.ColumnIndex) : _TreeListView.GetItemRect(item.Index, ItemBoundsPortion.Label); _Editor.Size = rec.Size; _Editor.Location = rec.Location; _Editor.Top--; _Editor.Show(); _Editor.Text = item.SubItems[_TreeListView.EditedItem.ColumnIndex].Text; _Editor.Focus(); }
/// <summary> /// Overridden OnElementChanged method which initializes new control as a Tizen map view. /// </summary> /// <param name="e">Event arguments.</param> protected override void OnElementChanged(ElementChangedEventArgs <TizenMapView> e) { if (Control == null) { _mapView = new MapView(Forms.NativeParent, Element.Service); SetNativeControl(_mapView); Control.Resize(Element.ControlHeight, Element.ControlWidth); Control.MapType = MapTypes.Normal; Control.ZoomLevel = Element.ZoomLevel; Control.Center = new Geocoordinates(Element.Center.Latitude, Element.Center.Longitude); Control.Show(); Element.Map = Control; } base.OnElementChanged(e); }
private void changeControlShow(Control control, bool show) { if (control.InvokeRequired) { control.Invoke(controlChange, control, show); } else { if (show) { control.Show(); } else { control.Hide(); } } }
public static void EmbedInto(this Control child, Control parent, EmbedType type, EmbededCallback embededCallback, bool isFixed = false, bool isSizable = false) { if (child != null && parent != null) { EmbedableTag tag = EmbedableTag.GetInstance(parent); tag.NewlyEmbededControls.Add(child); tag.Parent = parent; Control container = tag.ContentRegion; if (type == EmbedType.Fill || type == EmbedType.None) { child.EmbedInto(container, type == EmbedType.Fill); return; } #region Generate SplitContainer according to the EmbedType SplitContainer splitter; SplitterPanel fillPanel; SplitterPanel contentPanel; GenerateSplitter(parent, type, tag, out splitter, out fillPanel, out contentPanel, isSizable); #endregion if (splitter != null) { splitter.IsSplitterFixed = isFixed; } fillPanel.Controls.Add(child); container.Controls.Add(splitter); splitter.Dock = DockStyle.Fill; tag.ContentRegion = contentPanel; #region Adjust fill panel size AdjustFillPanel(child, type, splitter); #endregion if (child is ScreenRegion) { child.Show(); } if (embededCallback != null) { embededCallback(child); } } }
private void AddWindows(UserControl f, SkinButton button) { if (button != null) { button.BaseColor = Color.GreenYellow; } HideAllControlInPanel(); Control c = IsExitWindowsInPanel(f); if (c == null) { panelMain.Controls.Add(f); f.Dock = DockStyle.Fill; } else { c.Show(); } }
internal void ShowControl(SequenceEnum value) { Control new_value = null; if (controls.ContainsKey(value)) { new_value = controls[value]; } else { new_value = CreateControl(value); controls[value] = new_value; } new_value.Parent = this; new_value.Dock = DockStyle.Fill; new_value.BringToFront(); new_value.Show(); }
public static void Run(Control form, RenderCallback renderCallback, bool useDoEvents = false) { if (form == null || renderCallback == null) { throw new ArgumentNullException(); } form.Show(); using (var render = new RenderLoop(form)) { render.UseDoEvents = useDoEvents; while (render.NextFrame()) { renderCallback(); } } }
// This shows the next control // Returns False when no more controls to show private bool ShowNextControl() { if (showcontrols.Count > 0) { int tabindex = showcontrols[showcontrols.Count - 1].TabIndex; while ((showcontrols.Count > 0) && (showcontrols[showcontrols.Count - 1].TabIndex == tabindex)) { Control c = showcontrols[showcontrols.Count - 1]; c.Show(); showcontrols.RemoveAt(showcontrols.Count - 1); } return(showcontrols.Count > 0); } else { return(false); } }
private void ShowFakeControl(Control control) { if (m_listViewSubItem != null) // Check if an actual item was clicked { var ClickedItem = m_listViewSubItem.Bounds; // Get the bounds of the item clicked // Adjust the top and left of the control ClickedItem.X += listView1.Left; ClickedItem.Y += listView1.Top; control.Bounds = ClickedItem; // Set Control bounds to match calculation control.Text = m_listViewSubItem.Text; // Set the default text for the Control to be the clicked item's text control.Show(); // Show the Control control.BringToFront(); // Make sure it is on top control.Focus(); // Give focus to the Control } }
// Set current page private void SetCurrentPage(int n) { OnPageChanging(n); // hide previous page if (currentControl != null) { currentControl.Hide(); } // currentPage = n; // update dialog text this.Text = "设备配置精灵" + " - 页 " + ((int)(n + 1)).ToString() + " / " + workPanel.Controls.Count.ToString(); // show new page currentControl = workPanel.Controls[currentPage]; IWizardPage page = (IWizardPage)currentControl; currentControl.Show(); // description descriptionLabel.Text = page.PageDescription; // notify the page page.Display(); if (n > 0) { if (page.ControlWidth > 0) { workPanel.Width = page.ControlWidth; workPanel.Height = page.ControlHeight; this.Height = controlPanel.Height + workPanel.Height + descPannel.Height; this.Width = workPanel.Width; } } // update conrol buttons UpdateControlButtons(); }
/// <summary> /// Private rendering loop /// </summary> public void Run(RenderCallback renderCallback) { // Show the form _form.Show(); // Main rendering loop); while (_isAlive) { if (UseCustomDoEvents) { // Previous code not compatible with Application.AddMessageFilter but faster then DoEvents Win32Native.NativeMessage msg; while (Win32Native.PeekMessage(out msg, _windowHandle, 0, 0, 0) != 0) { if (Win32Native.GetMessage(out msg, _windowHandle, 0, 0) == -1) { throw new InvalidOperationException(String.Format(CultureInfo.InvariantCulture, "An error happened in rendering loop while processing windows messages. Error: {0}", Marshal.GetLastWin32Error())); } Win32Native.TranslateMessage(ref msg); Win32Native.DispatchMessage(ref msg); } } else { // Revert back to Application.DoEvents in order to support Application.AddMessageFilter // Seems that DoEvents is compatible with Mono unlike Application.Run that was not running // correctly. Application.DoEvents(); } if (_isAlive) { renderCallback(); } } _form.Disposed -= _form_Disposed; MessageFilterHook.RemoveMessageFilter(_windowHandle, this); }
/// <summary> /// Runs the specified main loop for the specified windows form. /// </summary> /// <param name="form">The form.</param> /// <param name="renderCallback">The rendering callback.</param> public static void Run(Control form, RenderCallback renderCallback) { if (form == null) { throw new ArgumentNullException("form"); } if (renderCallback == null) { throw new ArgumentNullException("renderCallback"); } form.Show(); using (var renderLoop = new RenderLoop(form)) { while (renderLoop.NextFrame()) { renderCallback(); } } }
private void EditableListView_Click(object sender, EventArgs e) { editingCol = -1; editingRow = -1; if (editor != null) { int nStart = X; int spos = 0; int epos = this.Columns[0].Width; for (int i = 0; i < this.Columns.Count; i++) { if (nStart > spos && nStart < epos) { subItemSelected = i; break; } spos = epos; epos += this.Columns[i].Width; } subItemText = li.SubItems[subItemSelected].Text; int row = li.Index; int col = subItemSelected; Control control = editor.getTableCellEditorComponent(this, li.Text, row, col); if (control != null) { editingCol = col; editingRow = row; //Rectangle r = new Rectangle(spos, li.Bounds.Y, epos, li.Bounds.Bottom); System.Drawing.Size size = new System.Drawing.Size(epos - spos, li.Bounds.Bottom - li.Bounds.Top); System.Drawing.Point location = new System.Drawing.Point(spos, li.Bounds.Y); control.Size = size; control.Location = location; control.Show(); control.Focus(); control.LostFocus += new EventHandler(control_LostFocus); control.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.control_KeyPress); } } }
private void NodeNameInput(string file) { if (!_stringInput) { DebugLog.Warn("No String Input Menu not defined."); return; } Control control = new Control(_stringInput); if (control.Show() != ShowResult.FIRST) { DebugLog.Warn("Failed to show Node Selector menu."); return; } StringInputHook hook = control.Instance.GetComponent <StringInputHook>(); hook.SetTitle("Start Node Name"); if (PlayerPrefs.HasKey("PreviousNode")) { hook.SetName(PlayerPrefs.GetString("PreviousNode")); } hook.OnSubmit = node => { if (string.IsNullOrEmpty(node)) { DebugLog.Warn("Node Name is empty."); return; } control.Destroy(); Playing = true; PlayerPrefs.SetString("PreviousNode", node); InitTutors(file, node); }; }
private void widnowTick_Tick(object sender, EventArgs e) { OnWindowTick?.Invoke(); if (needCleaning) { //TODO: do proper clean up. Controls.Clear(); needCleaning = false; } else { UnqueueRender(); } if (controlQueue.Count > 0) { Control ctrl = controlQueue.Dequeue(); Controls.Add(ctrl); ctrl.Show(); ctrl.Refresh(); } }
/// <summary> /// Runs the specified main loop for the specified windows form. /// </summary> /// <param name="form">The form.</param> /// <param name="renderCallback">The rendering callback.</param> /// <param name="useApplicationDoEvents">if set to <c>true</c> indicating whether the render loop should use the default <see cref="Application.DoEvents"/> instead of a custom window message loop lightweight for GC. Default is false.</param> /// <exception cref="System.ArgumentNullException">form /// or /// renderCallback</exception> public static void Run(Control form, RenderCallback renderCallback, bool useApplicationDoEvents = false) { if (form == null) { throw new ArgumentNullException("form"); } if (renderCallback == null) { throw new ArgumentNullException("renderCallback"); } form.Show(); using var renderLoop = new RenderLoop(form) { UseApplicationDoEvents = useApplicationDoEvents }; while (renderLoop.NextFrame()) { renderCallback(); } }
/// <summary> /// ShowControl에서 Control을 보여줄 때, 스크롤과 Margin으로 인한 보정오류가 발생하므로, 그 부분을 메인에서 처리해 준다. /// </summary> /// <param name="control"></param> /// <param name="x"></param> /// <param name="y"></param> internal void SetControlPositionInMain(Control control, Point positionInBuffer) { int newLeft = positionInBuffer.X + _ownerTree.Margin.Left; int newTop = positionInBuffer.Y + _ownerTree.Margin.Top; if (_ownerTree.Controls.Contains(control)) { if (newLeft != control.Left || newTop != control.Top)//위치가 바뀌었을 때만.. { control.SetBounds(newLeft, newTop, 0, 0, BoundsSpecified.Location); //control.SetBounds(x + Margin.Left, y, 0, 0, BoundsSpecified.Location); } } else { control.Left = newLeft; control.Top = newTop; _ownerTree.Controls.Add(control); control.Show(); } }
public void ShowControl(ControlsEnum ctrl) { Control new_ctrl = null; //If our dictionary already contains instance of if (controls.ContainsKey(ctrl)) { new_ctrl = controls[ctrl]; ControlOnLoad(ctrl); } else { new_ctrl = CreateControl(ctrl); controls[ctrl] = new_ctrl; } new_ctrl.Parent = pnlMain; new_ctrl.Dock = DockStyle.Fill; new_ctrl.BringToFront(); new_ctrl.Show(); }
private void callForm(string argForm) { if (argForm == "Mini") { this.WindowState = FormWindowState.Minimized; return; } Control ctr = null; string strForm = getFormName(argForm); try { ctr = pnMain.Controls.Find(strForm, false).FirstOrDefault(); if (ctr == null) { string[] str = strForm.Split('.'); addForm(str[0], str[1]); pnMain.Controls.Find(strForm, false).FirstOrDefault().Show(); } else { ctr.Show(); } } catch (Exception ex) { ComVar.Var.writeToLog(this.Name + "/callForm : " + ex.ToString()); return; } try { pnMain.Controls.Find(ComVar.Var._Frm_Curr.ToUpper(), false).FirstOrDefault().Hide(); ComVar.Var._Frm_Curr = strForm; } catch (Exception ex) { ComVar.Var.writeToLog(this.Name + "/callForm : " + ex.ToString()); } }
public void SeriesChangesWhenFunctionBindingListChanges() { IFunction function = new Function(); IVariable yVariable = new Variable <double>("y"); IVariable xVariable = new Variable <double>("x"); function.Arguments.Add(xVariable); function.Components.Add(yVariable); function[1.0] = 2.0; function[2.0] = 5.0; function[3.0] = 1.0; ILineChartSeries ls = ChartSeriesFactory.CreateLineSeries(); ls.YValuesDataMember = function.Components[0].DisplayName; ls.XValuesDataMember = function.Arguments[0].DisplayName; var synchronizeObject = new Control(); synchronizeObject.Show(); var functionBindingList = new FunctionBindingList(function) { SynchronizeInvoke = synchronizeObject }; ls.DataSource = functionBindingList; //a change in the function should change the series function[1.0] = 20.0; while (functionBindingList.IsProcessing) { Application.DoEvents(); } Assert.AreEqual(20, ls.YValues[0]); }
public static void ShowDebug(bool bl) { if (DebugDock.InvokeRequired) { DebugDock.Invoke(new MethodInvoker(() => { ShowDebug(bl); })); } else { if (bl) { DebugDock.Show(); MainDock.RowStyles[0] = new RowStyle(SizeType.Percent, .75f); MainDock.RowStyles[1] = new RowStyle(SizeType.Percent, .25f); } else { DebugDock.Hide(); MainDock.RowStyles[0] = new RowStyle(SizeType.Percent, 1f); MainDock.RowStyles[1] = new RowStyle(SizeType.Percent, 0f); } } }
private void listBox_SelectedIndexChanged(object sender, EventArgs e) { CategoryData data = listBox.SelectedItem as CategoryData; if (data == null || data.Control != activeControl) { if (activeControl != null) { activeControl.Hide(); Controls.Remove(activeControl); activeControl = null; } if (data != null) { activeControl = data.Control; SetControlSize(activeControl); Controls.Add(activeControl); activeControl.Show(); } } }
public void ShowControl(MenuAplikasi ma) { if (newctrl != null) { newctrl.Hide(); } if (controls.ContainsKey(ma)) { newctrl = controls[ma]; } else { newctrl = CreateCtrl(ma); controls[ma] = newctrl; } newctrl.Dock = DockStyle.Fill; newctrl.Parent = FFrameWindow; newctrl.BringToFront(); newctrl.Show(); }
public void AddElement(GameObject prefab, float x, float y, out float width) { Control control = new Control(prefab); if (control.Show() == ShowResult.FIRST) { control.Instance.transform.SetParent(_content); var rect = control.Instance.GetComponent <RectTransform>(); float yUi = (_content.rect.height - rect.rect.height) * y; rect.anchoredPosition = new Vector2 { x = x, y = yUi }; width = rect.rect.width; } else { width = 0; } }
private void RunRenderLoop() { OnInitialization(this, EventArgs.Empty); try { // Use custom render loop // Show the control for WinForm, let HwndHost show it for WPF if (wpfBorderControl == null) { Control.Show(); } using (RenderLoop = new RenderLoop(Control) { UseApplicationDoEvents = DesktopContext.UseApplicationDoEvents }) { while (RenderLoop.NextFrame()) { if (Exiting) { if (Control != null) { Control.Dispose(); Control = null; } break; } OnTick(this, EventArgs.Empty); } } } finally { OnShutdown(this, EventArgs.Empty); } }
/** <summary> Event handler for the "Connect" button. </summary> */ private void Connect_Click(object sender, RoutedEventArgs e) { try { var cs = "server=" + this.dbIP.Text + ";" + "port=" + this.dbPort.Text + ";" + "uid=" + this.dbUsername.Text + ";" + "pwd=" + this.dbPassword.Password; var con = new MySqlConnection(cs); con.Open(); con.Close(); DBLoginEncrypted login = new DBLoginEncrypted(); login.Username = Protect(this.dbUsername.Text); login.Password = Protect(this.dbPassword.Password); login.IP = Protect(this.dbIP.Text); login.Port = Protect(this.dbPort.Text); WriteXML(login); } catch (MySqlException ex) { MessageBox.Show("Unable to connect to a DB.\n" + ex.Number.ToString() + " - " + ex.Message, "FAI Secretary", MessageBoxButton.OK, MessageBoxImage.Error); return; } catch (Exception) { MessageBox.Show("Unable to connect to a DB.", "FAI Secretary", MessageBoxButton.OK, MessageBoxImage.Error); return; } Control window = new Control(this.dbUsername.Text, this.dbPassword.Password, this.dbIP.Text, this.dbPort.Text); App.Current.MainWindow = window; this.Close(); window.Show(); }
private void copyControl(Control sourceControl, Control targetControl) { if (sourceControl.GetType() != targetControl.GetType()) { throw new Exception("Incorrect control types"); } foreach (PropertyInfo sourceProperty in sourceControl.GetType().GetProperties()) { object newValue = sourceProperty.GetValue(sourceControl, null); MethodInfo mi = sourceProperty.GetSetMethod(true); string[] propertyAllowedToCopy = { "Size", "Location", "Text", "BackgroundImage", "BackColor", "Enabled", "ForeColor", "Image", "Text" }; if (mi != null) { bool ValidStat = false; foreach (String PropertyName in propertyAllowedToCopy) { if (sourceProperty.Name == PropertyName) { ValidStat = true; } if (ValidStat) { sourceProperty.SetValue(targetControl, newValue, null); if (targetControl.Enabled == false) { targetControl.Hide(); } else { targetControl.Show(); } } } } } }
private void hideAll(Control control, Control button) { foreach (var item in MENU.Controls) { if (item.GetType() == typeof(GunaGradientButton)) { GunaGradientButton gunabutton = (GunaGradientButton)item; GunaGradientButton targetButton = (GunaGradientButton)button; if (gunabutton == targetButton) { gunabutton.BaseColor1 = Color.FromArgb(218, 233, 252); gunabutton.BaseColor2 = Color.FromArgb(218, 233, 252); } else if (gunabutton.Name == "exite") { } else { gunabutton.BaseColor1 = Color.Transparent; gunabutton.BaseColor2 = Color.Transparent; } } } foreach (var item in homa_container.Controls) { Control a = (Control)item; if (control != null && a == control) { a.Show(); } else { a.Hide(); } } }
private void btnLogin_Click(object sender, RoutedEventArgs e) //*****the function of login button***** { if (txtUsername.Text == "") //check if the username field is empty { MessageBox.Show("You have to enter your Matric number (username) to log in!"); return; } else if (passwordBox1.Password == "") //check if the password field is empty { MessageBox.Show("You have to enter your password to log in!"); return; } else { StreamReader SR; string S; SR = File.OpenText(@"students.txt"); //load data from 'students.txt' using StreamReader S = SR.ReadLine(); while (S != null) //using the while loop to load data to the 3 lists { string[] words = S.Split(','); if (words.Count() > 4) { nameList.Add(words[0]); usernameList.Add(words[1]); passwordList.Add(words[2]); } S = SR.ReadLine(); } SR.Close(); bool check = false; for (int i = 0; i < usernameList.Count(); i++) { if (txtUsername.Text == usernameList[i]) //to check if the username entered by the user exists in the data base { if (passwordBox1.Password == passwordList[i]) //the case which the password is correct { StreamWriter writer = new StreamWriter(@"matricNo.txt"); writer.WriteLine(usernameList[i]); writer.Close(); StreamWriter writers = new StreamWriter(@"name.txt"); writers.WriteLine(nameList[i]); writers.Close(); Control controlwindow = new Control(); controlwindow.Show(); controlwindow.labelwelcome.Content = nameList[i]+" (" + usernameList[i] +") "; // MessageBox.Show("Welcome, " + nameList[i] + "!"); this.Close(); check = true; return; } else if (passwordBox1.Password != passwordList[i]) //the case which the password is incorrect { MessageBox.Show("The password you entered is invalid. Please try again."); check = true; return; } } } if (check == false) //the case the username is not registered in the data base { MessageBox.Show("No such user! Please check again!"); } } }