Skip to content

Commit

Permalink
Merge branch 'release/2.0.28.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Pohatu committed Oct 21, 2024
2 parents 17759f3 + 7dc3466 commit 1af3f7a
Show file tree
Hide file tree
Showing 35 changed files with 176 additions and 97 deletions.
6 changes: 3 additions & 3 deletions Core/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#region license
#region license
// Copyright (c) 2021 20Road Limited
//
// This file is part of DevChecker.
Expand Down Expand Up @@ -50,5 +50,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.27.0")]
[assembly: AssemblyFileVersion("2.0.27.0")]
[assembly: AssemblyVersion("2.0.28.0")]
[assembly: AssemblyFileVersion("2.0.28.0")]
6 changes: 3 additions & 3 deletions CustomActions/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#region license
#region license
// Copyright (c) 2021 20Road Limited
//
// This file is part of DevChecker.
Expand Down Expand Up @@ -50,5 +50,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.27.0")]
[assembly: AssemblyFileVersion("2.0.27.0")]
[assembly: AssemblyVersion("2.0.28.0")]
[assembly: AssemblyFileVersion("2.0.28.0")]
6 changes: 3 additions & 3 deletions MessageCrap/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Reflection;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

Expand Down Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.27.0")]
[assembly: AssemblyFileVersion("2.0.27.0")]
[assembly: AssemblyVersion("2.0.28.0")]
[assembly: AssemblyFileVersion("2.0.28.0")]
15 changes: 11 additions & 4 deletions Release notes.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Version 2.0.27.0
Release date: 22 Sep 2024
Version 2.0.28.0
Release date: 21 Oct 2024

*Features
Made 'ReadOnly' option common across all GuiOption types
*Fixes
Fixed toggles not initialising properly: https://github.com/MikePohatu/TsGui/issues/22


*Known issues
Expand All @@ -14,7 +14,14 @@ Release date: 22 Sep 2024
*Requires Microsoft .NET (WinPE-NetFx), Windows PowerShell (WinPE-PowerShell), and HTML (WinPE-HTA) be added to your boot image


---------------
Version 2.0.27.0
Release date: 22 Sep 2024

*Features
Made 'ReadOnly' option common across all GuiOption types

---------------
Version 2.0.26.0
Release date: 27 Jul 2024

Expand Down
70 changes: 70 additions & 0 deletions TestConfigs/Config.34-inverse_grouping.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<TsGui LiveData="TRUE">
<Height>530</Height>
<Width>500</Width>

<!--<ShowGridLines/>-->
<HardwareEval />

<Heading>
<Title>TsGui</Title>
<Text>Uncheck box to get extra page</Text>
<Bg-Color>#ff0000</Bg-Color>
</Heading>

<Page>
<Row>
<Column>
<GuiOption Type="CheckBox">
<Variable>options</Variable>
<Checked />
<Label>Additional options</Label>
<Toggle Group="Group_options">
<Enabled>FALSE</Enabled>
<Disabled>TRUE</Disabled>
<Hide />
</Toggle>
</GuiOption>
</Column>
</Row>
</Page>
<Page>
<Group>Group_options</Group>
<Row>
<Column>

<GuiOption Type="ComputerName" />

<GuiOption Type="CheckBox">
<Variable>TOGGLE_DiskID</Variable>
<Label>Choose disk</Label>
<HAlign>left</HAlign>

<Toggle Group="Group_Disk">
<Enabled>TRUE</Enabled>
<Disabled>FALSE</Disabled>
</Toggle>
</GuiOption>

<GuiOption Type="DropDownList" PurgeInactive="TRUE">
<Group>Group_Disk</Group>
<Variable>OSDDiskIndex</Variable>
<Label>Disk</Label>
<DefaultValue>0</DefaultValue>
<Query Type="Wmi">
<Wql>select Index,Caption,Size FROM Win32_DiskDrive where MediaType='Fixed hard disk media'</Wql>
<Property Name="Index" />
<Property Name="Index">
<Prefix>ID: </Prefix>
</Property>
<Property Name="Size">
<Calculate DecimalPlaces="2">VALUE/1073741824</Calculate>
<Append>GB</Append>
</Property>
<Property Name="Caption" />
<Separator> - </Separator>
</Query>
</GuiOption>
</Column>
</Row>
</Page>
</TsGui>
6 changes: 3 additions & 3 deletions TsGui.Tests/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#region license
#region license
// Copyright (c) 2020 Mike Pohatu
//
// This file is part of TsGui.
Expand Down Expand Up @@ -47,5 +47,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.27.0")]
[assembly: AssemblyFileVersion("2.0.27.0")]
[assembly: AssemblyVersion("2.0.28.0")]
[assembly: AssemblyFileVersion("2.0.28.0")]
1 change: 0 additions & 1 deletion TsGui.Tests/TestDirector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ public void CloseWithError(string Title, string Message) { }
public void AddOptionToLibary(IOption Option) { }
public void MoveNext() { }
public void MovePrevious() { }
public void AddToggleControl(IToggleControl ToogleControl) { }
public void Finish() { }
public void Cancel() { }
public void OnWindowClosing(object sender, CancelEventArgs e) { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ private async Task UpdateGroupIDAsync(string groupName, bool ismember)
if (option != null)
{
option.CurrentValue = member;
await option.UpdateValueAsync(MessageHub.CreateMessage(this, null));
await option.UpdateLinkedValueAsync(MessageHub.CreateMessage(this, null));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ protected void NotifyUpdate()
this.OnPropertyChanged(this, "LiveValue");
}

public async Task UpdateValueAsync(Message message)
public async Task UpdateLinkedValueAsync(Message message)
{
LinkingHub.Instance.SendUpdateMessage(this, message);
await Task.CompletedTask;
Expand Down
12 changes: 3 additions & 9 deletions TsGui/Director.cs
Original file line number Diff line number Diff line change
Expand Up @@ -263,17 +263,16 @@ public async Task InitAsync()
//now init all the options
await OptionLibrary.InitialiseOptionsAsync();

//init the groups
GroupLibrary.Init();

//subscribe to closing event
this.ParentWindow.Closing += this.OnWindowClosing;

if (ConfigData.Pages.Count > 0)
{
Log.Debug("Loading pages");
this.CurrentPage = ConfigData.Pages.First();
//update group settings to all controls
foreach (IToggleControl t in ConfigData.Toggles)
{ t.InitialiseToggle(); }

this.ParentWindow.DataContext = ConfigData.TsMainWindow;

// Now show and close the ghost window to make sure WinPE honours the
Expand Down Expand Up @@ -452,11 +451,6 @@ public void MovePrevious()
this.CurrentPage.Update();
this.UpdateWindow();
}

public void AddToggleControl(IToggleControl ToogleControl)
{
ConfigData.Toggles.Add(ToogleControl);
}

//Navigate to the current page, and update the datacontext of the window
private void UpdateWindow()
Expand Down
8 changes: 7 additions & 1 deletion TsGui/Grouping/Group.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ public GroupState State
if (this._state != value)
{
this._state = value;
StateEvent?.Invoke();
Log.Info("Group " + this.ID + " state changed. New state: " + this._state.ToString());
StateEvent?.Invoke();
}
}
}
Expand All @@ -66,5 +66,11 @@ public void Add(GroupableBase GroupableElement)
this._groupables.Add(GroupableElement);
this.StateEvent += GroupableElement.OnGroupStateChange;
}

public void Init()
{
Log.Info("Group " + this.ID + " Initialised. State: " + this._state.ToString());
StateEvent?.Invoke();
}
}
}
8 changes: 8 additions & 0 deletions TsGui/Grouping/GroupLibrary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,13 @@ public static void Reset()
{
_groups.Clear();
}

public static void Init()
{
foreach (var group in _groups.Values)
{
group.Init();
}
}
}
}
1 change: 0 additions & 1 deletion TsGui/Grouping/IToggleControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,5 @@ public interface IToggleControl
string CurrentValue { get; }
bool IsActive { get; }
event ToggleEvent ToggleEvent;
void InitialiseToggle();
}
}
34 changes: 24 additions & 10 deletions TsGui/Grouping/Toggle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,37 @@ namespace TsGui.Grouping
{
public class Toggle
{
//ID is set by either LoadXml or Create via the SetID() method
public string ID { get; private set; }
private Group _group;
private Dictionary<string, bool> _toggleValMappings = new Dictionary<string, bool>();
private bool _hiddenMode = false;
private bool _inverse = false;
private IToggleControl _option;


private Toggle(IToggleControl option)
{
this._option = option;
Director.Instance.AddToggleControl(option);
this._option.ToggleEvent += this.OnToggleEvent;
this.Init(option);
}

public Toggle(IToggleControl option, XElement InputXml)
{
this.Init(option);
this.LoadXml(InputXml);
}

private void Init(IToggleControl option)
{
this._option = option;
Director.Instance.AddToggleControl(option);
ConfigData.Toggles.Add(option);
this._option.ToggleEvent += this.OnToggleEvent;
this.LoadXml(InputXml);
}

private void SetGroup(Group group)
{
this._group = group;
this.ID = $"var:{this._option.VariableName}_gid:{group?.ID}";
}

/// <summary>
Expand All @@ -63,7 +75,7 @@ public static Toggle Create(IToggleControl option, string groupid, bool hide, bo
{
var toggle = new Toggle(option);

toggle._group = GroupLibrary.GetGroupFromID(groupid);
toggle.SetGroup(GroupLibrary.GetGroupFromID(groupid));
toggle._hiddenMode = hide;
toggle._inverse = invert;
toggle._toggleValMappings.Add("TRUE", true);
Expand All @@ -82,7 +94,7 @@ private void LoadXml(XElement InputXml)
throw new InvalidOperationException("No Group ID set in Toggle configured in XML: " + Environment.NewLine + InputXml);
}

this._group = GroupLibrary.GetGroupFromID(groupid);
this.SetGroup(GroupLibrary.GetGroupFromID(groupid));

IEnumerable<XElement> togglesX;
togglesX = InputXml.Elements("Enabled");
Expand Down Expand Up @@ -120,7 +132,7 @@ private void LoadXml(XElement InputXml)

public void OnToggleEvent()
{
Log.Trace($"Toggle Event received by toggle | VariableName: {this._option.VariableName} | Group: {this._group?.ID}" );
Log.Trace($"Toggle Event received by toggle: " + this.ID );
string val;
bool newenabled;

Expand All @@ -146,8 +158,10 @@ public void OnToggleEvent()
}
else
{
if (newenabled == true) { this.DisableGroup(); }
else { this.EnableGroup(); }
if (newenabled == true)
{ this.DisableGroup(); }
else
{ this.EnableGroup(); }
}
}
}
Expand Down
1 change: 0 additions & 1 deletion TsGui/IDirector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ public interface IDirector
void AddOptionToLibary(IOption Option);
void MoveNext();
void MovePrevious();
void AddToggleControl(IToggleControl ToogleControl);
void Finish();
void Cancel();
void OnWindowClosing(object sender, CancelEventArgs e);
Expand Down
2 changes: 1 addition & 1 deletion TsGui/Linking/ILinkSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ public interface ILinkSource: ISubscribable
/// <summary>
/// Request a link source to update the value set on the option.
/// </summary>
Task UpdateValueAsync(Message message);
Task UpdateLinkedValueAsync(Message message);
}
}
2 changes: 1 addition & 1 deletion TsGui/Linking/LinkingHub.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public async void OnTopicMessageReceived(string topic, Message message)
IOption option = this.GetSourceOption(message.Payload as string);
if (option != null)
{
await option.UpdateValueAsync(message);
await option.UpdateLinkedValueAsync(message);
}
break;
default:
Expand Down
6 changes: 3 additions & 3 deletions TsGui/Options/MiscOption.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public MiscOption() : base()
}

//public methods
public async Task UpdateValueAsync(Message message)
public async Task UpdateLinkedValueAsync(Message message)
{
await Task.CompletedTask;
LinkingHub.Instance.SendUpdateMessage(this, message);
Expand All @@ -81,7 +81,7 @@ public async Task UpdateValueAsync(Message message)

public async Task OnSourceValueUpdatedAsync(Message message)
{
await this.UpdateValueAsync(message);
await this.UpdateLinkedValueAsync(message);
}

protected void NotifyViewUpdate()
Expand All @@ -94,7 +94,7 @@ protected void NotifyViewUpdate()
//This is called by the controller once everything is loaded
public async Task InitialiseAsync()
{
await this.UpdateValueAsync(null);
await this.UpdateLinkedValueAsync(null);
}
}
}
Loading

0 comments on commit 1af3f7a

Please sign in to comment.