/// <summary> /// Constructor /// </summary> /// <param name="parts">TextParts that the CountMacro is contained in</param> /// <param name="part">CountMacro object displayed in this group box</param> /// <param name="includeContextMenu">Indicator for whether to include the /// context menu. Values are INCLUDECONTEXTMENU and DONOTINCLUDECONTEXTMENU</param> public CountMacroGroupBox(TextParts parts, TextPart part, bool includeContextMenu) : base(parts, part, includeContextMenu) { InitializeComponent(); CountMacro macro = part as CountMacro; this.DataContext = macro; foreach(TextPart p in macro.DesignText) { MacroGroupBox box = p.BuildGroupBox(macro.DesignText, INCLUDECONTENTMENU); box.Margin = INSETMARGIN; DesignTextPanel.Children.Add(box); } foreach(TextPart p in macro.TrueText) { MacroGroupBox box = p.BuildGroupBox(macro.TrueText, INCLUDECONTENTMENU); box.Margin = INSETMARGIN; TrueTextPanel.Children.Add(box); } foreach(TextPart p in macro.FalseText) { MacroGroupBox box = p.BuildGroupBox(macro.FalseText, INCLUDECONTENTMENU); box.Margin = INSETMARGIN; FalseTextPanel.Children.Add(box); } }
private TextParts GetHtmlEncodedTextParts(TextParts textParts) { return(new TextParts( HttpUtility.HtmlEncode(textParts.BeforeHotkey), HttpUtility.HtmlEncode(textParts.Hotkey), HttpUtility.HtmlEncode(textParts.AfterHotkey))); }
/// <summary> /// Constructor /// </summary> /// <param name="parts">TextParts that the AdifExistsMacro is contained in</param> /// <param name="part">AdifExistsMacro object displayed in this group box</param> /// <param name="includeContextMenu">Indicator for whether to include the /// context menu. Values are INCLUDECONTEXTMENU and DONOTINCLUDECONTEXTMENU</param> public AdifExistsMacroGroupBox(TextParts parts, TextPart part, bool includeContextMenu) : base(parts, part, includeContextMenu) { InitializeComponent(); AdifExistsMacro macro = part as AdifExistsMacro; SeparateCheckBox.DataContext = macro; AdifField.DataContext = macro.AdifField; foreach(TextPart p in macro.DesignText) { MacroGroupBox box = p.BuildGroupBox(macro.DesignText, INCLUDECONTENTMENU); box.Margin = INSETMARGIN; DesignTextPanel.Children.Add(box); } foreach(TextPart p in macro.ExistsText) { MacroGroupBox box = p.BuildGroupBox(macro.ExistsText, INCLUDECONTENTMENU); box.Margin = INSETMARGIN; ExistsTextPanel.Children.Add(box); } foreach(TextPart p in macro.DoesntExistText) { MacroGroupBox box = p.BuildGroupBox(macro.DoesntExistText, INCLUDECONTENTMENU); box.Margin = INSETMARGIN; DoesntExistTextPanel.Children.Add(box); } }
public void AddTextPart(string value, Encoding encoding = null, IEnumerable <KeyValuePair <string, string> > properties = null) { TextParts.Add(new TextPart { Text = value, Encoding = encoding, Properties = properties }); }
private void DoMergeWords() { var cnt = SelectedTextParts.Count; if (cnt == 0) { Messenger.Default.Send("No selection"); return; } TextPart mergedWords = null; var toDelete = new List <TextPart>(); TextPart firstPart = null; var foundCount = 0; var orderedParts = SelectedTextParts.Distinct().OrderBy(a => a.StartMills).ToList(); foreach (var word in orderedParts) { //if (foundCount == cnt) //{ // break; // found all //} if (SelectedTextParts.Contains(word)) { if (mergedWords == null) { mergedWords = new TextPart { StartMills = word.StartMills, Text = "" }; firstPart = word; } else { toDelete.Add(word); } mergedWords.Text = mergedWords.Text.Trim() + " " + word.Text.Trim(); //mergedWords.TextWidth += word.TextWidth; foundCount++; } } //mergedWords.Text = mergedWords.Text.Trim(); firstPart.Text = mergedWords.Text; var lastPart = orderedParts[orderedParts.Count - 1]; firstPart.TextWidth = (lastPart.StartMills + lastPart.TextWidth) - firstPart.StartMills; for (var ix = 0; ix < toDelete.Count; ix++) { TextParts.Remove(toDelete[ix]); } RaisePropertyChanged("FullText"); }
/// <summary> /// Constructor /// </summary> /// <param name="parts">TextParts that the ManagerMacro is contained in</param> /// <param name="part">ManagerMacro object displayed in this group box</param> /// <param name="includeContextMenu">Indicator for whether to include the /// context menu. Values are INCLUDECONTEXTMENU and DONOTINCLUDECONTEXTMENU</param> public ManagerMacroGroupBox(TextParts parts, TextPart part, bool includeContextMenu) : base(parts, part, includeContextMenu) { InitializeComponent(); ManagerMacro macro = part as ManagerMacro; foreach(TextPart p in macro.DesignText) { MacroGroupBox box = p.BuildGroupBox(macro.DesignText, INCLUDECONTENTMENU); box.Margin = INSETMARGIN; DesignTextPanel.Children.Add(box); } foreach(TextPart p in macro.NoManagerText) { MacroGroupBox box = p.BuildGroupBox(macro.NoManagerText, INCLUDECONTENTMENU); box.Margin = INSETMARGIN; NoManagerTextPanel.Children.Add(box); } }
public void GoToDayNumber(int dayNumber, System.Action onComplete) { int startNumber = dayNumber - NUMBER_COUNT / 2; for (int i = 0; i < numberTexts.Count; i++) { int theNumber = startNumber + i; TextParts theText = numberTexts[i]; theText.theText.text = theNumber.ToString(); theText.theText.color = GetColorForDay(theNumber); theText.theTransform.anchoredPosition = new Vector2(theNumber * SPACE_PER_NUMBER, 0); } float xPos = -((float)dayNumber * SPACE_PER_NUMBER); this.EnsureCoroutineStopped(ref moveRoutine); moveRoutine = StartCoroutine(MoveNumberLine(xPos, onComplete)); }
private void DoSelectedDelete() { if (SelectedTextParts == null || SelectedTextParts.Count == 0) { return; } var copied = SelectedTextParts.ToList(); var answ = System.Windows.MessageBox.Show($"Are you sure you want to delete {copied.Count} selected text bits?", "Confirm delete...", MessageBoxButton.YesNo); if (answ == MessageBoxResult.Yes) { for (var x = 0; x < copied.Count; x++) { TextParts.Remove(copied[x]); } } RaisePropertyChanged("FullText"); }
private string GetFormattedString(TextParts textParts) { var stringBuilder = new StringBuilder(100); if (!string.IsNullOrEmpty(textParts.BeforeHotkey)) { stringBuilder.Append(textParts.BeforeHotkey); } if (!string.IsNullOrEmpty(textParts.Hotkey)) { AppendHotkeyBeginTag(stringBuilder, textParts.Hotkey); stringBuilder.Append(textParts.Hotkey); AppendHotkeyEndTag(stringBuilder); } if (!string.IsNullOrEmpty(textParts.AfterHotkey)) { stringBuilder.Append(textParts.AfterHotkey); } return(stringBuilder.ToString()); }
private void DoAddSpaceBefore() { if (SelectedTextParts.Count == 0) { Messenger.Default.Send("No selection"); return; } TextPart firstWord = SelectedTextParts.OrderBy(a => a.StartMills).First(); int collectionIndex = 0; TextPart newSpace = new TextPart { TextWidth = 500, Text = "???" }; newSpace.StartMills = firstWord.StartMills - newSpace.TextWidth - 100; TextParts.Insert(collectionIndex, newSpace); RaisePropertyChanged("FullText"); }
/// <summary> /// Builds a group box to display the StaticTextViewer for this StaticText object /// </summary> /// <param name="parts">TextParts object that this StaticText object is contained in</param> /// <param name="includeContentMenu">Boolean to indicate whether the ContextMenu should be /// displayable or not. Use the values defined in MacroExpander.cs rather than true/false.</param> /// <returns>MacroExpander object containing the StaticTextViewer for this StaticText object</returns> public override MacroGroupBox BuildGroupBox(TextParts parts, bool includeContextMenu) { StaticTextGroupBox box = new StaticTextGroupBox(parts, this, includeContextMenu); box.DataContext = this; return box; }
/// <summary> /// Create the group box that will display this TextPart /// </summary> /// <param name="parts">TextParts object containing this TextPart</param> /// <param name="includeContentMenu">Indicator for whether to include the /// context menu. Values are INCLUDECONTEXTMENU and DONOTINCLUDECONTEXTMENU</param> /// <returns></returns> public abstract MacroGroupBox BuildGroupBox(TextParts parts, bool includeContentMenu);
/// <summary> /// Constructor /// </summary> /// <param name="parts">TextParts object that this dialog will display and interact with</param> public TextMacrosDialog(TextParts parts) { InitializeComponent(); partItems = parts; IsDirty = false; }
/// <summary> /// Creates an AdifExistsMacroGroupBox object based on this AdifExistsMacro /// </summary> /// <param name="parts">TextParts object that this AdifExistsMacro is included in</param> /// <param name="includeContextMenu">Boolean to indicate whether the ContextMenu should be /// displayable or not. Use the values defined in MacroExpander.cs rather than true/false.</param> /// <returns></returns> public override MacroGroupBox BuildGroupBox(TextParts parts, bool includeContextMenu) { AdifExistsMacroGroupBox box = new AdifExistsMacroGroupBox(parts, this, includeContextMenu); return box; }
/// <summary> /// Constructor /// </summary> /// <param name="parts">TextParts object that contains the specified StaticText object</param> /// <param name="part">StaticText object to be displayed</param> /// <param name="includeContextMenu">Indicator for whether to include the /// context menu. Values are INCLUDECONTEXTMENU and DONOTINCLUDECONTEXTMENU</param> public StaticTextGroupBox(TextParts parts, TextPart part, bool includeContextMenu) : base(parts, part, includeContextMenu) { InitializeComponent(); }
internal override string RecordDataToString() { return(String.Join(" ", TextParts.Select(x => "\"" + x.ToMasterfileLabelRepresentation() + "\""))); }
/// <summary> /// Creates a ManagerMacroGroupBox object based on this ManagerMacro /// </summary> /// <param name="parts">TextParts object that this ManagerMacro is included in</param> /// <param name="includeContextMenu">Boolean to indicate whether the ContextMenu should be /// displayable or not. Use the values defined in MacroExpander.cs rather than true/false.</param> /// <returns></returns> public override MacroGroupBox BuildGroupBox(TextParts parts, bool includeContextMenu) { ManagerMacroGroupBox box = new ManagerMacroGroupBox(parts, this, includeContextMenu); return box; }
/// <summary> /// Constructor /// </summary> /// <param name="parts">TextParts object that the specified TextPart is part of</param> /// <param name="part">TextPart object to display</param> /// <param name="includeContextMenu">Indicator for whether to include the /// context menu. Values are INCLUDECONTEXTMENU and DONOTINCLUDECONTEXTMENU</param> public MacroGroupBox(TextParts parts, TextPart part, bool includeContextMenu) { SetValue(PartItemsPropertyKey, parts); PartItem = part; InitializeGroupBox(includeContextMenu); }