Skip to content

Commit cb94dac

Browse files
committed
Fix #39 Loading the config file again removes the directories from the sources
Fix #33 Parity device size warning is misleading - Improve text for the "Full sync" button - Fix Warn log colouring - Add Horizontal size for listbox items - Add Launch Wordpad for current config file - Improved Cannot Add message Test #26 "z-parity" is not catered for.
1 parent 3e000a8 commit cb94dac

13 files changed

Lines changed: 227 additions & 88 deletions
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
22
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=RAID/@EntryIndexedValue">RAID</s:String>
3+
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateStaticFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /&gt;</s:String>
34
<s:Boolean x:Key="/Default/UserDictionary/Words/=Coghlan/@EntryIndexedValue">True</s:Boolean>
45
<s:Boolean x:Key="/Default/UserDictionary/Words/=smartctl/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

Elucidate/Elucidate/Controls/ListBoxLog.cs

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -40,31 +40,34 @@ private class LogString
4040
public ListBoxLog(ListBox listBox, int maxLinesInListbox = DEFAULT_MAX_LINES_IN_LISTBOX, int defaultUpdateFrequencyms = DEFAULT_UPDATE_FREQUENCY_MS)
4141
{
4242
disposed = false;
43-
timer1 = new Timer
44-
{
45-
Enabled = listBox.IsHandleCreated,
46-
Interval = defaultUpdateFrequencyms,
47-
};
48-
timer1.Tick += timer1_Tick;
4943

5044
listBoxInt = listBox;
5145
maxEntriesInListBox = maxLinesInListbox;
5246

5347
Paused = false;
5448

5549
listBoxInt.SelectionMode = SelectionMode.MultiExtended;
50+
// Display a horizontal scroll bar.
51+
listBoxInt.HorizontalScrollbar = true;
52+
listBoxInt.DrawMode = DrawMode.OwnerDrawVariable;
5653

5754
listBoxInt.HandleCreated += OnHandleCreated;
5855
listBoxInt.HandleDestroyed += OnHandleDestroyed;
5956
listBoxInt.DrawItem += DrawItemHandler;
6057
listBoxInt.KeyDown += KeyDownHandler;
6158
listBoxInt.MeasureItem += MeasureItem;
62-
listBoxInt.DrawMode = DrawMode.OwnerDrawVariable;
6359

6460
MenuItem[] menuItems = new[] { new MenuItem("Copy", CopyMenuOnClickHandler) };
6561
listBoxInt.ContextMenu = new ContextMenu(menuItems);
6662
listBoxInt.ContextMenu.Popup += CopyMenuPopupHandler;
6763

64+
timer1 = new Timer
65+
{
66+
Enabled = listBox.IsHandleCreated,
67+
Interval = defaultUpdateFrequencyms,
68+
};
69+
timer1.Tick += timer1_Tick;
70+
6871
}
6972

7073
public void LogMethod(string levelUppercase, string message)
@@ -121,12 +124,18 @@ private void MeasureItem(object sender, MeasureItemEventArgs e)
121124
};
122125
}
123126

124-
e.ItemHeight = (int) (e.Graphics.MeasureString(logEvent.Message, listBoxInt.Font).Height + 2);
127+
SizeF sizeF = e.Graphics.MeasureString(logEvent.Message, listBoxInt.Font);
128+
129+
e.ItemHeight = (int)(sizeF.Height + 2);
130+
if (listBoxInt.HorizontalExtent < sizeF.Width)
131+
{
132+
listBoxInt.HorizontalExtent = (int) (sizeF.Width + 2);
133+
}
125134
}
126135
}
127136

128137

129-
private void DrawItemHandler(object sender, DrawItemEventArgs e)
138+
private void DrawItemHandler(object sender, DrawItemEventArgs e)
130139
{
131140
if (e.Index >= 0)
132141
{
@@ -139,7 +148,7 @@ private void DrawItemHandler(object sender, DrawItemEventArgs e)
139148
logEvent = new LogString
140149
{
141150
LevelUppercase = @"FATAL",
142-
Message = ((ListBox) sender).Items[e.Index].ToString()
151+
Message = ((ListBox)sender).Items[e.Index].ToString()
143152
};
144153
}
145154

@@ -152,7 +161,7 @@ private void DrawItemHandler(object sender, DrawItemEventArgs e)
152161
case @"ERROR":
153162
color = Brushes.Red;
154163
break;
155-
case @"WARNING":
164+
case @"WARN":
156165
color = Brushes.Goldenrod;
157166
break;
158167
case @"INFO":
@@ -161,7 +170,7 @@ private void DrawItemHandler(object sender, DrawItemEventArgs e)
161170
case @"DEBUG":
162171
color = Brushes.Gray;
163172
break;
164-
case @"TRACE":
173+
case @"TRACE":
165174
color = Brushes.DarkGray;
166175
break;
167176
default:
@@ -223,7 +232,7 @@ private void timer1_Tick(object sender, EventArgs e)
223232

224233
alreadyDequing = true;
225234
// Now lock in case the timer is overlapping !
226-
//BeginInvoke((MethodInvoker)delegate
235+
listBoxInt.BeginInvoke((MethodInvoker)delegate
227236
{
228237
//some stuffs for best performance
229238
listBoxInt.BeginUpdate();
@@ -248,15 +257,15 @@ private void timer1_Tick(object sender, EventArgs e)
248257
//}
249258
alreadyDequing = false;
250259
}
251-
//);
260+
);
252261
}
253262
catch (Exception ex)
254263
{
255264
Debug.Fail(ex.Message);
256265
}
257266
}
258267

259-
private void CopyToClipboard()
268+
private void CopyToClipboard()
260269
{
261270
if (listBoxInt.SelectedItems.Count > 0)
262271
{

Elucidate/Elucidate/Controls/LiveRunLogControl.Designer.cs

Lines changed: 18 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Elucidate/Elucidate/Controls/LiveRunLogControl.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,20 @@ public partial class LiveRunLogControl : UserControl
5656
private ProcessPriorityClass requested = ProcessPriorityClass.Normal;
5757
private string lastError;
5858
private List<string> batchPaths;
59-
private static ListBoxLog listBoxLog;
59+
private static ListBoxLog ListBoxLog;
6060

6161
public bool IsRunning { get; set; }
62+
6263
private CommandType CommandTypeRunning { get; set; }
6364

6465
public LiveRunLogControl()
6566
{
6667
InitializeComponent();
6768

68-
listBoxLog = new ListBoxLog(rtbLiveLog);
69+
if (ListBoxLog == null )
70+
{
71+
ListBoxLog = new ListBoxLog(rtbLiveLog);
72+
}
6973

7074
AddThreadingCallbacks();
7175

@@ -594,7 +598,7 @@ private void LiveRunLogControl_Resize(object sender, EventArgs e)
594598
// This is used by the logging to force all to the output window
595599
public static void LogMethod(string levelUppercase, string message)
596600
{
597-
listBoxLog?.LogMethod(levelUppercase, message);
601+
ListBoxLog?.LogMethod(levelUppercase, message);
598602
}
599603
}
600604
}

Elucidate/Elucidate/Elucidate.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
</AssemblyInfoVersionSettings>
3333
<PrimaryVersionType>AssemblyVersionAttribute</PrimaryVersionType>
3434
<AssemblyInfoFilePath>Properties\AssemblyInfo.cs</AssemblyInfoFilePath>
35-
<AssemblyVersion>19.2.830.8</AssemblyVersion>
35+
<AssemblyVersion>19.2.850.9</AssemblyVersion>
3636
<UpdatePackageVersion>False</UpdatePackageVersion>
3737
<AssemblyInfoVersionType>SettingsVersion</AssemblyInfoVersionType>
3838
<InheritWinAppVersionFrom>None</InheritWinAppVersionFrom>
@@ -399,7 +399,7 @@
399399
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
400400
<ProjectExtensions>
401401
<VisualStudio>
402-
<UserProperties BuildVersion_UseUniversalClock="False" BuildVersion_UpdateFileVersion="False" BuildVersion_UpdateAssemblyVersion="False" BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="YearStamp.MonthStamp.DayStamp.Increment" />
402+
<UserProperties BuildVersion_BuildVersioningStyle="YearStamp.MonthStamp.DayStamp.Increment" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" BuildVersion_UpdateAssemblyVersion="False" BuildVersion_UpdateFileVersion="False" BuildVersion_UseUniversalClock="False" />
403403
</VisualStudio>
404404
</ProjectExtensions>
405405
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.

Elucidate/Elucidate/Forms/ElucidateForm.Designer.cs

Lines changed: 14 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Elucidate/Elucidate/Forms/ElucidateForm.cs

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
using System.Diagnostics;
3232
using System.IO;
3333
using System.Linq;
34+
using System.Media;
3435
using System.Reflection;
3536
using System.Text;
3637
using System.Windows.Forms;
@@ -118,7 +119,11 @@ private void tabControl_Deselecting(object sender, TabControlCancelEventArgs e)
118119
#region Main Menu Toolbar Handlers
119120
private void EditSnapRAIDConfigToolStripMenuItem_Click(object sender, EventArgs e)
120121
{
121-
if (commonTab.liveRunLogControl1.ActionWorker.IsBusy) { return; }
122+
if (commonTab.liveRunLogControl1.ActionWorker.IsBusy)
123+
{
124+
SystemSounds.Beep.Play();
125+
return;
126+
}
122127

123128
using (Settings settingsForm = new Settings())
124129
{
@@ -232,6 +237,28 @@ private void changeLogToolStripMenuItem_Click(object sender, EventArgs e)
232237
{
233238
Process.Start(@"https://github.com/Smurf-IV/Elucidate/commits");
234239
}
240+
241+
private void editConfigDirectlyToolStripMenuItem_Click(object sender, EventArgs e)
242+
{
243+
if (commonTab.liveRunLogControl1.ActionWorker.IsBusy)
244+
{
245+
SystemSounds.Beep.Play();
246+
return;
247+
}
248+
using (Process process = new Process
249+
{
250+
StartInfo = new ProcessStartInfo(@"Wordpad.exe", Properties.Settings.Default.ConfigFileLocation)
251+
})
252+
{
253+
process.Start();
254+
//Wait for the window to finish loading.
255+
process.WaitForInputIdle();
256+
//Wait for the process to end.
257+
process.WaitForExit();
258+
}
259+
LoadConfigFile(true);
260+
}
261+
235262
#endregion Menu Handlers
236263

237264
private void ElucidateForm_ResizeEnd(object sender, EventArgs e)

0 commit comments

Comments
 (0)