Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion AdamController.Controls/CustomControls.Services/ControlHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@ namespace AdamController.Controls.CustomControls.Services
public class ControlHelper : BindableBase, IControlHelper
{
public event BlocklyColumnWidthChangeEventHandler RaiseBlocklyColumnWidthChangeEvent;
public event IsVideoShowChangeEventHandler IsVideoShowChangeEvent;

public ControlHelper() {}
public ControlHelper(bool isVideoShowLastValue)
{
IsShowVideo = isVideoShowLastValue;
}

private double mainGridActualWidth = double.NaN;
public double MainGridActualWidth
Expand Down Expand Up @@ -60,6 +64,19 @@ public BlocklyViewMode CurrentBlocklyViewMode
}
}

private bool isShowVideo;
public bool IsShowVideo
{
get => isShowVideo;
set
{
bool isNewValue = SetProperty(ref isShowVideo, value);

if (isNewValue)
OnRaiseIsVideoShowChangeEvent();
}
}

private void UpdateBlocklyColumnWidth()
{
var dividedScreen = MainGridActualWidth/2;
Expand Down Expand Up @@ -104,5 +121,12 @@ protected virtual void OnRaiseBlocklyColumnWidthChangeEvent()
BlocklyColumnWidthChangeEventHandler raiseEvent = RaiseBlocklyColumnWidthChangeEvent;
raiseEvent?.Invoke(this);
}

protected virtual void OnRaiseIsVideoShowChangeEvent()
{
IsVideoShowChangeEventHandler raiseEvent = IsVideoShowChangeEvent;
raiseEvent?.Invoke(this);

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ namespace AdamController.Controls.CustomControls.Services

public delegate void BlocklyColumnWidthChangeEventHandler(object sender);

public delegate void IsVideoShowChangeEventHandler(object sender);

#endregion

public interface IControlHelper : IDisposable
Expand All @@ -14,11 +16,14 @@ public interface IControlHelper : IDisposable

public event BlocklyColumnWidthChangeEventHandler RaiseBlocklyColumnWidthChangeEvent;

public event IsVideoShowChangeEventHandler IsVideoShowChangeEvent;

#endregion

public double MainGridActualWidth { get; set; }
public double BlocklyColumnActualWidth { get; set; }
public double BlocklyColumnWidth { get; set; }
public BlocklyViewMode CurrentBlocklyViewMode { get; set; }
public bool IsShowVideo { get; set; }
}
}
3 changes: 3 additions & 0 deletions AdamController.Core/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,9 @@
<setting name="WebViewZoomFactor" serializeAs="String">
<value>0.7</value>
</setting>
<setting name="ShowVideo" serializeAs="String">
<value>True</value>
</setting>
</AdamController.Core.Properties.Settings>
<AdamController.Properties.Settings>
<setting name="VideoDataExchangePort" serializeAs="String">
Expand Down
31 changes: 31 additions & 0 deletions AdamController.Core/Converters/BoolToViewModeIconsConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using MahApps.Metro.IconPacks;
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;

namespace AdamController.Core.Converters
{
[ValueConversion(typeof(bool?), typeof(Visibility))]
public class BoolToViewModeIconsConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
bool? booleanNulableValue = null;

if (value != null)
booleanNulableValue = (bool)value;

if (booleanNulableValue == true)
return PackIconFeatherIconsKind.Video;

return PackIconRemixIconKind.BillLine;
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException("Convert only one way");
}

}
}
9 changes: 2 additions & 7 deletions AdamController.Core/Converters/BoolToVisibilityConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,12 @@ public object Convert(object value, Type targetType, object parameter, CultureIn
bool? booleanNulableValue = null;

if (value != null)
{
booleanNulableValue = (bool)value;
}


if (booleanNulableValue == true)
return Visibility.Hidden;
if(booleanNulableValue == null)
return Visibility.Hidden;
return Visibility.Visible;

return Visibility.Visible;
return Visibility.Collapsed;
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
Expand Down
30 changes: 30 additions & 0 deletions AdamController.Core/Converters/BoolToVisibilityReConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;

namespace AdamController.Core.Converters
{
[ValueConversion(typeof(bool?), typeof(Visibility))]
public class BoolToVisibilityReConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
bool? booleanNulableValue = null;

if (value != null)
booleanNulableValue = (bool)value;

if (booleanNulableValue == true)
return Visibility.Collapsed;

return Visibility.Visible;
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException("Convert only one way");
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace AdamController.Core.Converters
{
public class SelectedItemToContentConverter : IMultiValueConverter
/*public class SelectedItemToContentConverter : IMultiValueConverter
{
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
Expand All @@ -17,5 +17,5 @@ public object[] ConvertBack(object value, Type[] targetTypes, object parameter,
{
return targetTypes.Select(t => Binding.DoNothing).ToArray();
}
}
}*/
}
34 changes: 34 additions & 0 deletions AdamController.Core/Converters/StringToViewRegionIconsConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using MahApps.Metro.IconPacks;
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;

namespace AdamController.Core.Converters
{
[ValueConversion(typeof(bool?), typeof(Visibility))]
public class StringToViewRegionIconsConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
string stringValue = string.Empty;

if (value != null)
stringValue = (string)value;

if (stringValue == SubRegionNames.SubRegionVisualSettings)
return PackIconSimpleIconsKind.Scratch;

if (stringValue == SubRegionNames.SubRegionScratch)
return PackIconFeatherIconsKind.Settings;

return PackIconSimpleIconsKind.AbbRobotStudio;
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException("Convert only one way");
}

}
}
10 changes: 5 additions & 5 deletions AdamController.Core/Model/VectorModel.cs
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
using Newtonsoft.Json;
using System.Text.Json.Serialization;

namespace AdamController.Core.Model
{

public class VectorModel
{
[JsonProperty("move")]
[JsonPropertyName("move")]
public VectorItem Move { get; set; }
}

public class VectorItem
{
[JsonProperty("x")]
[JsonPropertyName("x")]
public float X { get; set; }

[JsonProperty("y")]
[JsonPropertyName("y")]
public float Y { get; set; }

[JsonProperty("z")]
[JsonPropertyName("z")]
public float Z { get; set; }

}
Expand Down
14 changes: 13 additions & 1 deletion AdamController.Core/Properties/Settings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions AdamController.Core/Properties/Settings.settings
Original file line number Diff line number Diff line change
Expand Up @@ -278,5 +278,8 @@
<Setting Name="WebViewZoomFactor" Type="System.Double" Scope="User">
<Value Profile="(Default)">0.7</Value>
</Setting>
<Setting Name="ShowVideo" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
</Settings>
</SettingsFile>
Loading