Skip to content

Commit e05bdaa

Browse files
committed
Rename Lookup items to start uppercase
1 parent 1c311d0 commit e05bdaa

File tree

3 files changed

+28
-32
lines changed

3 files changed

+28
-32
lines changed

Text-Grab/Models/LookupItem.cs

+8-8
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ public enum LookupItemKind
1313

1414
public class LookupItem : IEquatable<LookupItem>
1515
{
16-
public string shortValue { get; set; } = string.Empty;
17-
public string longValue { get; set; } = string.Empty;
16+
public string ShortValue { get; set; } = string.Empty;
17+
public string LongValue { get; set; } = string.Empty;
1818

1919
public Wpf.Ui.Controls.SymbolRegular UiSymbol
2020
{
@@ -40,14 +40,14 @@ public LookupItem()
4040

4141
public LookupItem(string sv, string lv)
4242
{
43-
shortValue = sv;
44-
longValue = lv;
43+
ShortValue = sv;
44+
LongValue = lv;
4545
}
4646

4747
public LookupItem(HistoryInfo historyInfo)
4848
{
49-
shortValue = historyInfo.CaptureDateTime.Humanize() + Environment.NewLine + historyInfo.CaptureDateTime.ToString("F");
50-
longValue = historyInfo.TextContent.Length > 100 ? historyInfo.TextContent[..100].Trim() + "…" : historyInfo.TextContent.Trim();
49+
ShortValue = historyInfo.CaptureDateTime.Humanize() + Environment.NewLine + historyInfo.CaptureDateTime.ToString("F");
50+
LongValue = historyInfo.TextContent.Length > 100 ? historyInfo.TextContent[..100].Trim() + "…" : historyInfo.TextContent.Trim();
5151

5252
HistoryItem = historyInfo;
5353

@@ -64,10 +64,10 @@ public override string ToString()
6464
if (HistoryItem is not null)
6565
return $"{HistoryItem.CaptureDateTime:F} {HistoryItem.TextContent}";
6666

67-
return $"{shortValue} {longValue}";
67+
return $"{ShortValue} {LongValue}";
6868
}
6969

70-
public string ToCSVString() => $"{shortValue},{longValue}";
70+
public string ToCSVString() => $"{ShortValue},{LongValue}";
7171

7272
public bool Equals(LookupItem? other)
7373
{

Text-Grab/Views/QuickSimpleLookup.xaml

+5-5
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@
221221
<TextBox
222222
VerticalAlignment="Top"
223223
Loaded="EditingTextBox_Loaded"
224-
Text="{Binding shortValue}" />
224+
Text="{Binding ShortValue}" />
225225
</DataTemplate>
226226
</DataGridTemplateColumn.CellEditingTemplate>
227227
</DataGridTemplateColumn>
@@ -234,15 +234,15 @@
234234
</DataGridTemplateColumn.Header>
235235
<DataGridTemplateColumn.CellTemplate>
236236
<DataTemplate>
237-
<TextBlock Style="{StaticResource CellTextBlock}" Text="{Binding shortValue}" />
237+
<TextBlock Style="{StaticResource CellTextBlock}" Text="{Binding ShortValue}" />
238238
</DataTemplate>
239239
</DataGridTemplateColumn.CellTemplate>
240240
<DataGridTemplateColumn.CellEditingTemplate>
241241
<DataTemplate>
242242
<TextBox
243243
VerticalAlignment="Top"
244244
Loaded="EditingTextBox_Loaded"
245-
Text="{Binding shortValue}" />
245+
Text="{Binding ShortValue}" />
246246
</DataTemplate>
247247
</DataGridTemplateColumn.CellEditingTemplate>
248248
</DataGridTemplateColumn>
@@ -255,15 +255,15 @@
255255
</DataGridTemplateColumn.Header>
256256
<DataGridTemplateColumn.CellTemplate>
257257
<DataTemplate>
258-
<TextBlock Style="{StaticResource CellTextBlock}" Text="{Binding longValue}" />
258+
<TextBlock Style="{StaticResource CellTextBlock}" Text="{Binding LongValue}" />
259259
</DataTemplate>
260260
</DataGridTemplateColumn.CellTemplate>
261261
<DataGridTemplateColumn.CellEditingTemplate>
262262
<DataTemplate>
263263
<TextBox
264264
AcceptsTab="True"
265265
Loaded="EditingTextBox_Loaded"
266-
Text="{Binding longValue}" />
266+
Text="{Binding LongValue}" />
267267
</DataTemplate>
268268
</DataGridTemplateColumn.CellEditingTemplate>
269269
</DataGridTemplateColumn>

Text-Grab/Views/QuickSimpleLookup.xaml.cs

+15-19
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
using Microsoft.VisualBasic.FileIO;
2-
using Microsoft.Win32;
1+
using Microsoft.Win32;
32
using System;
43
using System.Collections.Generic;
54
using System.Diagnostics;
@@ -19,9 +18,6 @@
1918

2019
namespace Text_Grab.Views;
2120

22-
/// <summary>
23-
/// Interaction logic for QuickSimpleLookup.xaml
24-
/// </summary>
2521
public partial class QuickSimpleLookup : Wpf.Ui.Controls.FluentWindow
2622
{
2723
#region Fields
@@ -63,11 +59,11 @@ private static LookupItem ParseStringToLookupItem(char splitChar, string row)
6359
List<string> cells = [.. row.Split(splitChar)];
6460
LookupItem newRow = new();
6561
if (cells.FirstOrDefault() is string firstCell)
66-
newRow.shortValue = firstCell;
62+
newRow.ShortValue = firstCell;
6763

68-
newRow.longValue = "";
64+
newRow.LongValue = "";
6965
if (cells.Count > 1 && cells[1] is not null)
70-
newRow.longValue = string.Join(" ", cells.Skip(1).ToArray());
66+
newRow.LongValue = string.Join(" ", cells.Skip(1).ToArray());
7167
return newRow;
7268
}
7369

@@ -443,16 +439,16 @@ private async void PutValueIntoClipboard(KeyboardModifiersDown? keysDown = null)
443439
if (selectedLookupItems.FirstOrDefault() is not LookupItem lookupItem)
444440
return;
445441

446-
if (Uri.TryCreate(lookupItem.longValue, UriKind.Absolute, out Uri? uri))
442+
if (Uri.TryCreate(lookupItem.LongValue, UriKind.Absolute, out Uri? uri))
447443
{
448-
Process.Start(new ProcessStartInfo(lookupItem.longValue) { UseShellExecute = true });
444+
Process.Start(new ProcessStartInfo(lookupItem.LongValue) { UseShellExecute = true });
449445
this.Close();
450446
return;
451447
}
452448
break;
453449
case KeyboardModifiersDown.Ctrl:
454450
foreach (LookupItem lItem in selectedLookupItems)
455-
stringBuilder.AppendLine(lItem.shortValue);
451+
stringBuilder.AppendLine(lItem.ShortValue);
456452
break;
457453
case KeyboardModifiersDown.Shift:
458454
foreach (LookupItem lItem in selectedLookupItems)
@@ -478,11 +474,11 @@ private async void PutValueIntoClipboard(KeyboardModifiersDown? keysDown = null)
478474
break;
479475
}
480476
case LookupItemKind.Link:
481-
Process.Start(new ProcessStartInfo(lItem.longValue) { UseShellExecute = true });
477+
Process.Start(new ProcessStartInfo(lItem.LongValue) { UseShellExecute = true });
482478
openedHistoryItemOrLink = true;
483479
break;
484480
default:
485-
stringBuilder.AppendLine(lItem.longValue);
481+
stringBuilder.AppendLine(lItem.LongValue);
486482
break;
487483
}
488484
}
@@ -879,9 +875,9 @@ private void OpenInETWMenuItem_Click(object sender, RoutedEventArgs e)
879875
{
880876
case LookupItemKind.Simple:
881877
StringBuilder sb = new();
882-
sb.Append(lookupItem.shortValue);
878+
sb.Append(lookupItem.ShortValue);
883879
sb.Append(Environment.NewLine);
884-
sb.AppendLine(lookupItem.longValue);
880+
sb.AppendLine(lookupItem.LongValue);
885881
EditTextWindow etw = new(sb.ToString(), false);
886882
etw.Show();
887883
break;
@@ -893,7 +889,7 @@ private void OpenInETWMenuItem_Click(object sender, RoutedEventArgs e)
893889
return;
894890
}
895891

896-
EditTextWindow etw2 = new(lookupItem.longValue, false);
892+
EditTextWindow etw2 = new(lookupItem.LongValue, false);
897893
etw2.Show();
898894
break;
899895
case LookupItemKind.GrabFrame:
@@ -904,14 +900,14 @@ private void OpenInETWMenuItem_Click(object sender, RoutedEventArgs e)
904900
return;
905901
}
906902

907-
EditTextWindow etw3 = new(lookupItem.longValue, false);
903+
EditTextWindow etw3 = new(lookupItem.LongValue, false);
908904
etw3.Show();
909905
break;
910906
case LookupItemKind.Link:
911907
StringBuilder sb2 = new();
912-
sb2.Append(lookupItem.shortValue);
908+
sb2.Append(lookupItem.ShortValue);
913909
sb2.Append(Environment.NewLine);
914-
sb2.AppendLine(lookupItem.longValue);
910+
sb2.AppendLine(lookupItem.LongValue);
915911
EditTextWindow etw4 = new(sb2.ToString(), false);
916912
etw4.Show();
917913
break;

0 commit comments

Comments
 (0)