//子线程执行接收数据任务 private void RecData(object sender, SerialDataReceivedEventArgs e) { try { String content = this.ComPort.ReadLine(); ContentBox.Dispatcher.BeginInvoke(new Action(() => ContentBox.Text += content + "\n")); ContentBox.Dispatcher.BeginInvoke(new Action(() => ContentBox.ScrollToEnd())); //预防输入数据不是纯数字 try { //将内容转化为Int32类型 layout.Dispatcher.BeginInvoke(new Action(() => RandTemp(Convert.ToInt32(content)))); }catch (Exception ex) { ContentBox.Dispatcher.BeginInvoke(new Action(() => ContentBox.Text += "-----------发生异常----------\n" + ex + "\n\n" + "\n" + "------------------------------\n")); } Thread thread = new Thread(() => PrintLog(content)); thread.Start(); } catch (Exception ex) { ContentBox.Dispatcher.BeginInvoke(new Action(() => ContentBox.Text += "-----------发生异常----------\n" + ex + "\n\n" + "\n" + "------------------------------\n")); } }
/// <summary> /// </summary> /// <param name="ss">The SpreadsheetPanel in the current Form1</param> private void DisplaySelection(SpreadsheetPanel ss) { if (_spreadsheet == null) { return; } int col, row; ss.GetSelection(out col, out row); // Convert col, row index to spreadsheet cell names. var cellName = ((char)(col + 65)) + (row + 1).ToString(CultureInfo.InvariantCulture); // Displays selected cell's name CellNameBox.Invoke(new Action(() => { CellNameBox.Text = cellName; })); var content = _spreadsheet.GetCellContents(cellName); // If content is a formula, prepend "=" before displaying var f = content as Formula; if (f != null) { ContentBox.Invoke(new Action(() => { ContentBox.Text = "=" + f; })); } // Otherwise just display the content. else { ContentBox.Invoke(new Action(() => { ContentBox.Text = content.ToString(); })); } // No need to fetch the value from the spreadsheet again, just copy it from // the spreadsheetpanel. This avoids reworking the FormulaError message. string value; ss.GetValue(col, row, out value); ValueBox.Invoke(new Action(() => { ValueBox.Text = value; })); }
public ListWindow(Gtk.WindowType type) : base(type) { vbox = new VBox(); list = new ListWidget(this); list.SelectionChanged += new EventHandler(OnSelectionChanged); list.ScrollEvent += new ScrollEventHandler(OnScrolled); scrollbar = new MonoDevelop.Components.CompactScrolledWindow(); scrollbar.Name = "CompletionScrolledWindow"; // use a different gtkrc style for GtkScrollBar scrollbar.Child = list; list.ButtonPressEvent += delegate(object o, ButtonPressEventArgs args) { if (args.Event.Button == 1 && args.Event.Type == Gdk.EventType.TwoButtonPress) { DoubleClick(); } }; vbox.PackEnd(scrollbar, true, true, 0); var colorBox = new EventBox(); colorBox.Add(vbox); ContentBox.Add(colorBox); this.AutoSelect = true; this.TypeHint = WindowTypeHint.Menu; Theme.CornerRadius = 0; Theme.Padding = 0; UpdateStyle(); Gui.Styles.Changed += HandleThemeChanged; IdeApp.Preferences.ColorScheme.Changed += HandleThemeChanged; }
private void SendBtn_Click(object sender, EventArgs e) { string text = ChatBox.Text; if (!text.Equals("")) { if (ContentBox.Text.Equals("")) { ContentBox.Text = "나: " + text; } else { ContentBox.Text += "\n" + "나: " + text; } ChatBox.Text = ""; ChatBox.Focus(); ContentBox.SelectionStart = ContentBox.Text.Length; ContentBox.ScrollToCaret(); } //else //{ // MessageBox.Show("내용을 입력해주세요.", "SocketChat", // MessageBoxButtons.OK, MessageBoxIcon.Error); //} }
public ParameterInformationWindow() { TypeHint = Gdk.WindowTypeHint.Tooltip; this.SkipTaskbarHint = true; this.SkipPagerHint = true; this.AllowShrink = false; this.AllowGrow = false; this.CanFocus = false; this.CanDefault = false; WindowTransparencyDecorator.Attach(this); headlabel = new MonoDevelop.Components.FixedWidthWrapLabel(); headlabel.Indent = -20; headlabel.FontDescription = FontService.GetFontDescription("Editor").CopyModified(1.1); headlabel.Wrap = Pango.WrapMode.WordChar; headlabel.BreakOnCamelCasing = false; headlabel.BreakOnPunctuation = false; descriptionBox.Spacing = 4; VBox vb = new VBox(false, 0); vb.PackStart(headlabel, true, true, 0); vb.PackStart(descriptionBox, true, true, 0); HBox hb = new HBox(false, 0); hb.PackStart(vb, true, true, 0); vb2.Spacing = 4; vb2.PackStart(hb, true, true, 0); ContentBox.Add(vb2); ShowAll(); DesktopService.RemoveWindowShadow(this); }
// PinWindow pinWindow; // TreeIter currentPinIter; public DebugValueWindow(Mono.TextEditor.TextEditor editor, int offset, StackFrame frame, ObjectValue value, PinnedWatch watch) : base(Gtk.WindowType.Toplevel) { this.TypeHint = WindowTypeHint.PopupMenu; this.AllowShrink = false; this.AllowGrow = false; this.Decorated = false; TransientFor = (Gtk.Window)editor.Toplevel; // Avoid getting the focus when the window is shown. We'll get it when the mouse enters the window AcceptFocus = false; sw = new ScrolledWindow(); sw.HscrollbarPolicy = PolicyType.Never; sw.VscrollbarPolicy = PolicyType.Never; tree = new ObjectValueTreeView(); sw.Add(tree); ContentBox.Add(sw); tree.Frame = frame; tree.CompactView = true; tree.AllowAdding = false; tree.AllowEditing = true; tree.HeadersVisible = false; tree.AllowPinning = true; tree.RootPinAlwaysVisible = true; tree.PinnedWatch = watch; DocumentLocation location = editor.Document.OffsetToLocation(offset); tree.PinnedWatchLine = location.Line; tree.PinnedWatchFile = ((ExtensibleTextEditor)editor).View.ContentName; tree.AddValue(value); tree.Selection.UnselectAll(); tree.SizeAllocated += OnTreeSizeChanged; tree.PinStatusChanged += delegate { Destroy(); }; // tree.MotionNotifyEvent += HandleTreeMotionNotifyEvent; sw.ShowAll(); // pinWindow = new PinWindow (this); // pinWindow.SetPinned (false); // pinWindow.ButtonPressEvent += HandlePinWindowButtonPressEvent; tree.StartEditing += delegate { Modal = true; }; tree.EndEditing += delegate { Modal = false; }; ShowArrow = true; Theme.CornerRadius = 3; }
private void TextInsert_Click(object sender, RoutedEventArgs e) { //FlowDocument fldoc = new FlowDocument(); // Paragraph par1 = new Paragraph(); // par1.Inlines.Add(new Run("g")); // fldoc.Blocks.Add(par1); //ContentBox.Document = fldoc; ContentBox.Paste(); }
private void CleanSpreadsheet() { DeregisterHandlers(); _spreadsheet = null; spreadsheetPanel1.Invoke(new Action(() => { spreadsheetPanel1.Clear(); })); CellNameBox.Invoke(new Action(() => { CellNameBox.Text = string.Empty; })); ValueBox.Invoke(new Action(() => { ValueBox.Text = string.Empty; })); ContentBox.Invoke(new Action(() => { ContentBox.Text = string.Empty; })); this.Invoke(new Action(() => { this.Text = "Spreadsheet Program - Not Connected"; })); }
/// <summary> /// 把服务端返回的语音识别结果输出到 UI。 /// </summary> /// <param name="format">The format.</param> /// <param name="args">The arguments.</param> private void WriteLine(string format, params object[] args) { var formattedStr = string.Format(format, args); Dispatcher.Invoke(() => { ContentBox.Text += (formattedStr + "\n"); ContentBox.ScrollToEnd(); }); }
RespondToMouseDoubleClick(Grasshopper.GUI.Canvas.GH_Canvas sender, Grasshopper.GUI.GH_CanvasMouseEvent e) { if (ContentBox.Contains(e.CanvasLocation)) { NelderMeadClass sc = Owner as NelderMeadClass; ((NelderMeadClass)this.Owner).ShowForm(); sc.ExpireSolution(true); return(Grasshopper.GUI.Canvas.GH_ObjectResponse.Handled); } return(Grasshopper.GUI.Canvas.GH_ObjectResponse.Ignore); }
private void LoadWindow(object sender, RoutedEventArgs e) { if (ShowPlainText) { ContentBox.Focus(); } else { ContentPwdBox.Focus(); } }
/* * When a user click the send button, this function will send a message type message to the server. */ private void Button_Click_Send(object sender, RoutedEventArgs e) { if (remoteService != null && isConnected == true) { MessageContent = ContentBox.Text; string messageType = "message"; string message = messageType + "|" + UserName + "|" + MessageContent; remoteService.SendMessage(message); ContentBox.Clear(); } }
private static ContentBox getRaces() { ContentBox result = new ContentBox(); List <string> races = new List <string>(); result.title = "Races"; result.content = command.returnCommandList(new string[] { "Alderan", "Brutaris", "Levenite", "Beholden" }); result.desc = "This is what race you were born as. Each race has some natural additaves."; return(result); }
/// <summary> /// Handles new cell being selected and helpts to update /// Content Boxes. /// </summary> /// <param name="sender"></param> private void spreadsheetPanel1_SelectionChanged(SpreadsheetPanel sender) { if (SelectionEvent != null) { int row, col; spreadsheetPanel1.GetSelection(out col, out row); SelectionEvent(GetName(col, row)); ContentBox.Select(); ContentBox.SelectionStart = 0; ContentBox.SelectionLength = ContentBox.Text.Length; } }
void AddLabel() { if (label == null) { alignment = new Gtk.Alignment(0.5f, 0.5f, 1f, 1f); alignment.SetPadding(6, 6, 6, 6); label = new Gtk.Label(); alignment.Add(label); ContentBox.Add(alignment); alignment.ShowAll(); } }
public override GH_ObjectResponse RespondToMouseDoubleClick(GH_Canvas sender, GH_CanvasMouseEvent e) { if (ContentBox.Contains(e.CanvasLocation)) { IfcOpenInRevit component = Owner as IfcOpenInRevit; System.Diagnostics.Debug.Write("double click called\n"); // Force the re-culculation of the component component.ExpireSolution(true); return(GH_ObjectResponse.Handled); } return(GH_ObjectResponse.Ignore); }
void AddLabel() { if (label == null) { alignment = new Gtk.Alignment(0.5f, 0.5f, 1f, 1f); alignment.SetPadding(4, 5, 4, 4); label = new Gtk.Label(); label.ModifyFont(Theme.Font); alignment.Add(label); ContentBox.Add(alignment); alignment.ShowAll(); } }
private void ContentBox_MouseDoubleClick(object sender, MouseButtonEventArgs e) { IsEditEnabled = !IsEditEnabled; if (IsEditEnabled) { ContentBox.Focus(); ContentBox.SelectionStart = ContentBox.Text.Length; ContentBox.SelectionLength = 0; } else { Keyboard.ClearFocus(); } }
public DebugValueWindow(TextEditor editor, int offset, StackFrame frame, ObjectValue value, PinnedWatch watch) : base(Gtk.WindowType.Toplevel) { this.TypeHint = WindowTypeHint.PopupMenu; this.AllowShrink = false; this.AllowGrow = false; this.Decorated = false; TransientFor = (Gtk.Window)(editor.GetNativeWidget <Gtk.Widget> ()).Toplevel; // Avoid getting the focus when the window is shown. We'll get it when the mouse enters the window AcceptFocus = false; sw = new ScrolledWindow(); sw.HscrollbarPolicy = PolicyType.Never; sw.VscrollbarPolicy = PolicyType.Never; UpdateTreeStyle(Theme.BackgroundColor); tree = new ObjectValueTreeView(); tree.Name = innerTreeName; sw.Add(tree); ContentBox.Add(sw); tree.Frame = frame; tree.CompactView = true; tree.AllowAdding = false; tree.AllowEditing = true; tree.HeadersVisible = false; tree.AllowPinning = true; tree.RootPinAlwaysVisible = true; tree.PinnedWatch = watch; var location = editor.OffsetToLocation(offset); tree.PinnedWatchLine = location.Line; tree.PinnedWatchFile = editor.FileName; tree.AddValue(value); tree.Selection.UnselectAll(); tree.SizeAllocated += OnTreeSizeChanged; tree.PinStatusChanged += OnPinStatusChanged; sw.ShowAll(); tree.StartEditing += OnStartEditing; tree.EndEditing += OnEndEditing; ShowArrow = true; Theme.CornerRadius = 3; PreviewWindowManager.WindowClosed += PreviewWindowManager_WindowClosed; }
public override Grasshopper.GUI.Canvas.GH_ObjectResponse RespondToMouseDoubleClick(Grasshopper.GUI.Canvas.GH_Canvas sender, Grasshopper.GUI.GH_CanvasMouseEvent e) { if ((ContentBox.Contains(e.CanvasLocation))) { CurrentOwner.SOLVE = true; // hit the export straight away, where we handle the folder selection! CurrentOwner.Export(); CurrentOwner.ExpireSolution(true); return(Grasshopper.GUI.Canvas.GH_ObjectResponse.Handled); } return(Grasshopper.GUI.Canvas.GH_ObjectResponse.Ignore); }
/// <summary> /// Open the biomorpher window upon doubleclick /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// <returns></returns> public override GH_ObjectResponse RespondToMouseDoubleClick(GH_Canvas sender, GH_CanvasMouseEvent e) { if ((ContentBox.Contains(e.CanvasLocation))) { if (Owner.Params.Input[0].SourceCount != 0 && Owner.Params.Input[1].SourceCount != 0) { myMainWindow = new BiomorpherWindow(MyOwner); myMainWindow.Show(); return(GH_ObjectResponse.Handled); } } return(GH_ObjectResponse.Ignore); }
public override GH_ObjectResponse RespondToMouseDoubleClick(GH_Canvas sender, GH_CanvasMouseEvent e) { if ((ContentBox.Contains(e.CanvasLocation))) { // Best to flip this to iron out any errors MyOwner.GO = !MyOwner.GO; MyOwner.ExpireSolution(true); return(GH_ObjectResponse.Handled); } return(GH_ObjectResponse.Ignore); }
public TooltipInformationWindow() : base() { TypeHint = Gdk.WindowTypeHint.Tooltip; this.SkipTaskbarHint = true; this.SkipPagerHint = true; if (IdeApp.Workbench != null) { this.TransientFor = IdeApp.Workbench.RootWindow; } this.AllowShrink = false; this.AllowGrow = false; this.CanFocus = false; this.CanDefault = false; this.Events |= Gdk.EventMask.EnterNotifyMask; headlabel = new FixedWidthWrapLabel(); headlabel.Indent = -20; var des = FontService.GetFontDescription("Editor").Copy(); des.Size = des.Size * 9 / 10; headlabel.FontDescription = des; // headlabel.MaxWidth = 400; headlabel.Wrap = Pango.WrapMode.WordChar; headlabel.BreakOnCamelCasing = false; headlabel.BreakOnPunctuation = false; descriptionBox.Spacing = 4; VBox vb = new VBox(false, 8); vb.PackStart(headlabel, true, true, 0); vb.PackStart(descriptionBox, true, true, 0); HBox hb = new HBox(false, 0); hb.PackStart(vb, true, true, 0); WindowTransparencyDecorator.Attach(this); vb2.Spacing = 4; vb2.PackStart(hb, true, true, 0); ContentBox.Add(vb2); var scheme = Mono.TextEditor.Highlighting.SyntaxModeService.GetColorStyle(IdeApp.Preferences.ColorScheme); Theme.SetSchemeColors(scheme); foreColor = scheme.PlainText.Foreground; headlabel.ModifyFg(StateType.Normal, (HslColor)foreColor); ShowAll(); DesktopService.RemoveWindowShadow(this); }
public TooltipInformationWindow() : base() { TypeHint = Gdk.WindowTypeHint.Tooltip; this.SkipTaskbarHint = true; this.SkipPagerHint = true; if (IdeApp.Workbench != null) { this.TransientFor = IdeApp.Workbench.RootWindow; } this.AllowShrink = false; this.AllowGrow = false; this.CanFocus = false; this.CanDefault = false; this.Events |= Gdk.EventMask.EnterNotifyMask; headLabel = new FixedWidthWrapLabel(); headLabel.Indent = -20; headLabel.FontDescription = FontService.GetFontDescription("Editor(TooltipSource)");; headLabel.Wrap = Pango.WrapMode.WordChar; headLabel.BreakOnCamelCasing = false; headLabel.BreakOnPunctuation = false; descriptionBox.Spacing = 4; VBox vb = new VBox(false, 8); vb.PackStart(headLabel, true, true, 4); vb.PackStart(descriptionBox, true, true, 4); HBox hb = new HBox(false, 4); hb.PackStart(vb, true, true, 6); WindowTransparencyDecorator.Attach(this); vb2.Spacing = 4; vb2.PackStart(hb, true, true, 0); ContentBox.Add(vb2); SetDefaultScheme(); ShowAll(); DesktopService.RemoveWindowShadow(this); }
private static ContentBox[] loadRaceMods(TraitBase race) { ContentBox[] result = new ContentBox[2]; result[1] = new ContentBox(); result[0] = new ContentBox(); result[0].title = "Stat Mods"; result[0].content = new List <string>(); result[0].currentChoice = -1; result[1].title = "Trait Mods"; result[1].content = new List <string>(); result[1].currentChoice = -1; foreach (string stat in race.skillMods) { string[] _stat = stat.Split(":"); string[] stats = Enum.GetNames(typeof(Enums.Skills)); for (int i = 0; i < stats.Length; i++) { if (_stat[0] == i.ToString()) { result[0].content.Add(stats[i] + " : " + _stat[1]); } } } foreach (string trait in race.statMods) { string[] _trait = trait.Split(":"); string[] traits = Enum.GetNames(typeof(Enums.Traits)); for (int x = 0; x < traits.Length; x++) { if (_trait[0] == x.ToString()) { result[1].content.Add(traits[x] + " : " + _trait[1]); } } } return(result); }
public ParameterInformationWindow() { TypeHint = Gdk.WindowTypeHint.Tooltip; this.SkipTaskbarHint = true; this.SkipPagerHint = true; this.AllowShrink = false; this.AllowGrow = false; this.CanFocus = false; this.CanDefault = false; Mono.TextEditor.PopupWindow.WindowTransparencyDecorator.Attach(this); headlabel = new MonoDevelop.Components.FixedWidthWrapLabel(); headlabel.Indent = -20; headlabel.FontDescription = FontService.GetFontDescription("Editor").CopyModified(1.1); headlabel.Wrap = Pango.WrapMode.WordChar; headlabel.BreakOnCamelCasing = false; headlabel.BreakOnPunctuation = false; descriptionBox.Spacing = 4; VBox vb = new VBox(false, 0); vb.PackStart(headlabel, true, true, 0); vb.PackStart(descriptionBox, true, true, 0); HBox hb = new HBox(false, 0); hb.PackStart(vb, true, true, 0); vb2.Spacing = 4; vb2.PackStart(hb, true, true, 0); ContentBox.Add(vb2); var scheme = Mono.TextEditor.Highlighting.SyntaxModeService.GetColorStyle(IdeApp.Preferences.ColorScheme); Theme.SetSchemeColors(scheme); foreColor = scheme.PlainText.Foreground; headlabel.ModifyFg(StateType.Normal, foreColor.ToGdkColor()); ShowAll(); DesktopService.RemoveWindowShadow(this); }
private void InsertBasicTags(string tag, bool parametric = false) { var text = ContentBox.Text; if (ContentBox.SelectionLength > 0) { var length = ContentBox.SelectionLength; text = text.Remove(ContentBox.SelectionStart, length); var openTag = $"[{tag}{(parametric ? "=" : "")}]"; text = text.Insert(ContentBox.SelectionStart, ContentBox.SelectedText.Wrap(openTag, $"[/{tag}]")); var selStart = ContentBox.SelectionStart + openTag.Length; Text = text; ContentBox.Select(selStart, length); } else { text = text.Insert(ContentBox.SelectionStart, "".Wrap($"[{tag}{(parametric ? "=" : "")}]", $"[/{tag}]")); Text = text; } }
public ListWindow(Gtk.WindowType type) : base(type) { vbox = new VBox (); list = new ListWidget (this); list.SelectionChanged += new EventHandler (OnSelectionChanged); list.ScrollEvent += new ScrollEventHandler (OnScrolled); scrollbar = new MonoDevelop.Components.CompactScrolledWindow (); scrollbar.Child = list; list.ButtonPressEvent += delegate(object o, ButtonPressEventArgs args) { if (args.Event.Button == 1 && args.Event.Type == Gdk.EventType.TwoButtonPress) DoubleClick (); }; vbox.PackEnd (scrollbar, true, true, 0); ContentBox.Add (vbox); this.AutoSelect = true; this.TypeHint = WindowTypeHint.Menu; Theme.CornerRadius = 4; }
public TooltipInformationWindow() : base() { TypeHint = Gdk.WindowTypeHint.Tooltip; this.SkipTaskbarHint = true; this.SkipPagerHint = true; this.AllowShrink = false; this.AllowGrow = false; this.CanFocus = false; this.CanDefault = false; this.Events |= Gdk.EventMask.EnterNotifyMask; headLabel = new FixedWidthWrapLabel(); headLabel.Indent = -20; headLabel.Wrap = Pango.WrapMode.WordChar; headLabel.BreakOnCamelCasing = false; headLabel.BreakOnPunctuation = false; descriptionBox.Spacing = 4; VBox vb = new VBox(false, 8); vb.PackStart(headLabel, true, true, 4); vb.PackStart(descriptionBox, true, true, 4); HBox hb = new HBox(false, 4); hb.PackStart(vb, true, true, 6); WindowTransparencyDecorator.Attach(this); vb2.Spacing = 4; vb2.PackStart(hb, true, true, 0); ContentBox.Add(vb2); vb2.ShowAll(); SetDefaultScheme(); Styles.Changed += HandleSkinChanged; IdeApp.Preferences.ColorScheme.Changed += HandleSkinChanged; }
private void ChangeBinding(string bindingTarget, bool twoWay = false) { if (ShowExpressionOnly) { bindingTarget = "ExpressionStr"; twoWay = true; } else { realBinding = (target : bindingTarget, mode : twoWay); } ContentBox.GetBindingExpression(TextBox.TextProperty)?.UpdateSource(); BindingOperations.ClearBinding(ContentBox, TextBox.TextProperty); var nwBinding = new Binding(bindingTarget) { UpdateSourceTrigger = UpdateSourceTrigger.Explicit, Mode = (twoWay) ? BindingMode.TwoWay : BindingMode.OneWay }; ContentBox.SetBinding(TextBox.TextProperty, nwBinding); }