private void CreateMessageRows() { void SetMessagePosition(MessageRow row, MessagePosition position) { MessageTypeBox.Controls .OfType<MessageRow>() .ToList() .ForEach(m => m.Checked = false); row.Checked = true; MessageEditor.Bind(position, () => { row.SetText(); }); } MessageTypeBox.Controls.Clear(); int y = 12; foreach (var (name, pos) in Positions) { var row = new MessageRow { Name = name, Location = new Point(10, y) }; row.Size = new Size(MessageTypeBox.Width - 12, row.Size.Height); row.Bind(name, pos, e => SetMessagePosition(row, e)); if (pos == _fps) { row.Checked = true; MessageEditor.Bind(pos, row.SetText); } y += row.Size.Height; MessageTypeBox.Controls.Add(row); } }
public DocumentCommentView() : base() { Name = nameof(DocumentCommentView); List.GenerateColumns = false; List.GenerateToString = false; List.ListInfo = new LayoutListInfo( new LayoutColumn() { Name = $"{nameof(DocumentComment.Message)}.{nameof(Message.User)}", FillWidth = true }, new LayoutColumn() { Name = $"{nameof(DocumentComment.Message)}.{nameof(Message.DateCreate)}", FillWidth = true }, new LayoutColumn() { Name = $"{nameof(DocumentComment.Message)}.{nameof(Message.Data)}", Row = 1 }) { ColumnsVisible = false, CalcHeigh = true, HeaderVisible = false, Indent = 6 }; editor = new MessageEditor { OnSending = new Action <Message>(OnSend), HeightRequest = 100 }; PackStart(editor, false); }
public static Task <bool> EditMessageAsync(this ActionScheduler actionScheduler, int messageId, string newText) { newText.ThrowIfNullOrEmpty(nameof(newText)); var action = new MessageEditor(messageId, newText); return(actionScheduler.ScheduleActionAsync <bool>(action)); }
public void WriteLine(string msg) { Dispatcher.BeginInvoke(new Action <string>(s => { MessageEditor.Document.Insert(MessageEditor.Document.TextLength, msg + "\r\n"); MessageEditor.ScrollToEnd(); }), msg); }
private void Button_Click(object sender, RoutedEventArgs e) { Flyout emojis = new Flyout(); emojis.FlyoutPresenterStyle = (Style)App.Current.Resources["FlyoutPresenterStyle1"]; var emojiPicker = new EmojiControl(); emojis.Content = emojiPicker; emojis.ShowAt(sender as Button); emojis.Closed += (o, o1) => { emojis = null; }; emojiPicker.PickedEmoji += (o, args) => { emojis.Hide(); //if (args.names.Count > 1) //{ // int newSelectionStart = MessageEditor.SelectionStart + args.names[0].Length + args.names[1].Length + 4; // MessageEditor.Text = MessageEditor.Text.Insert(MessageEditor.SelectionStart, ":" + args.names[0] + "::" + args.names[1] + ":"); // MessageEditor.SelectionStart = newSelectionStart; //} else //{ // int newSelectionStart = MessageEditor.SelectionStart + args.names[0].Length + 2; // MessageEditor.Text = MessageEditor.Text.Insert(MessageEditor.SelectionStart, ":" + args.names[0] + ":"); // MessageEditor.SelectionStart = newSelectionStart; //} string emojiText = ""; if (args.GetType() == typeof(EmojiControl.GuildSide)) { var emoji = (EmojiControl.GuildSide)args; if (emoji.surrogates.EndsWith(".gif")) { emojiText = "<a:" + emoji.names.First() + ":" + emoji.id + ">"; } else { emojiText = "<:" + emoji.names.First() + ":" + emoji.id + ">"; } } else { emojiText = args.surrogates; } int newSelectionStart = MessageEditor.SelectionStart + emojiText.Length; MessageEditor.Text = MessageEditor.Text.Insert(MessageEditor.SelectionStart, emojiText); MessageEditor.SelectionStart = newSelectionStart; MessageEditor.Focus(FocusState.Keyboard); }; }
void CreateMessageEditor() { messge = new MessageEditor { Location = new Point(10, 10) }; mMessageGrop = new GroupBox { Location = new Point(mQuestNameGrop.Right + 10, mQuestNameGrop.Top), Width = messge.Width + 20, Height = messge.Height + 20 }; mMessageGrop.Controls.Add(messge); Controls.Add(mMessageGrop); }
public MailEditorForm() { // Load player mail // TODO: Move this logic to ACSE.Core var playerMail = new GcnPlayerMail[10]; for (var i = 0; i < 10; i++) { //playerMail[i] = new GcnPlayerMail(); } InitializeComponent(); messageEditor = new MessageEditor(); //messageEditor.SetMailReference(); }
// Open msg file private void OpenMessageFile(string msgFile, int msgNum, TabInfo tab, bool context = false) { MessageEditor msgEdit = MessageEditor.MessageEditorInit(msgFile, msgNum, tab, true); if (context) { msgEdit.SendMsgLine += delegate(string msgLine) { Utilities.InsertText(msgLine, textEditor.ActiveTextAreaControl); }; } else { msgEdit.SendMsgLine += msgEdit_SendMsgLine; } msgEdit.closeOnSend = true; cForm.TopMost = false; msgEdit.ShowDialog(); // modal // update ParseCode(); }
private void SelectSuggestion(KeyValuePair <string, DawgSharp.DawgItem> item) { string suggestion; if (item.Value.InsertText == "") { suggestion = mentionPrefix + item.Key; } else { suggestion = mentionPrefix + item.Value.InsertText; } //EnableChanges = false; var str = MessageEditor.Text; MessageEditor.Text = PureText.Insert(selectionstart, suggestion); MessageEditor.Focus(FocusState.Pointer); MessageEditor.SelectionStart = selectionstart + suggestion.Length; SuggestionBlock.ItemsSource = null; SuggestionPopup.IsOpen = false; //EnableChanges = true; }
private void openMsgEditorButton_Click(object sender, EventArgs e) { MessageEditor editor = new MessageEditor(ref mGalaxy); editor.Show(); }
public void FocusTextBox() { MessageEditor.Focus(FocusState.Keyboard); }
private static void Init() { MessageEditor window = EditorWindow.GetWindow(typeof(MessageEditor)) as MessageEditor; window.Show(); }
private void MessageEditor_OnTextChanged(object sender, TextChangedEventArgs e) { MessageEditor.InvalidateLayout(); }