Add UIXControls

This commit is contained in:
Yoshi Askharoun
2025-07-12 23:44:01 -05:00
parent 958a1024a1
commit fb24662492
121 changed files with 749 additions and 0 deletions
+15
View File
@@ -0,0 +1,15 @@
using System;
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyProduct("Microsoft (R) Windows (R) Operating System")]
[assembly: AssemblyCopyright("Copyright (c) Microsoft Corporation. All rights reserved.")]
//[assembly: AssemblyFileVersion("4.8.2345.0")]
//[assembly: AssemblyKeyFile("e:\\temp\\471135\\public.amd64fre\\internal\\strongnamekeys\\fake\\36MSApp1024.snk")]
[assembly: ComVisible(false)]
//[assembly: AssemblyDelaySign(true)]
[assembly: AssemblyTitle("UIXControls")]
[assembly: CLSCompliant(false)]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyDescription("Zune Controls Library")]
//[assembly: AssemblyVersion("4.8.0.0")]
+52
View File
@@ -0,0 +1,52 @@
// Decompiled with JetBrains decompiler
// Type: UIXControls.CodeDialogManager
// Assembly: UIXControls, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
// MVID: 78800EA5-2757-404C-BA30-C33FCFC2852A
// Assembly location: C:\Program Files\Zune\UIXcontrols.dll
using Microsoft.Iris;
using System;
using System.Diagnostics.CodeAnalysis;
#nullable disable
namespace UIXControls
{
public class CodeDialogManager : ModelItem
{
private ArrayListDataSet _pendingCodeDialogs;
private static CodeDialogManager s_instance = new CodeDialogManager();
private CodeDialogManager() => _pendingCodeDialogs = new ArrayListDataSet();
public static CodeDialogManager Instance => s_instance;
public ArrayListDataSet PendingCodeDialogs => _pendingCodeDialogs;
internal void ShowCodeDialog(DialogHelper dialog)
{
if (_pendingCodeDialogs.Contains(dialog))
return;
_pendingCodeDialogs.Add(dialog);
}
public event EventHandler WindowCloseRequested;
public event EventHandler WindowCloseNotBlocked;
[SuppressMessage("Microsoft.Security", "CA2109", Justification = "FxCop misfire: This method IS referred to in other assemblies.")]
public void OnWindowCloseRequested(object sender, WindowCloseRequestedEventArgs args)
{
args.BlockCloseRequest();
if (WindowCloseRequested != null)
WindowCloseRequested(this, EventArgs.Empty);
FirePropertyChanged("WindowCloseRequested");
}
public void WindowCloseWasNotBlocked()
{
if (WindowCloseNotBlocked != null)
WindowCloseNotBlocked(this, EventArgs.Empty);
FirePropertyChanged("WindowCloseNotBlocked");
}
}
}
+77
View File
@@ -0,0 +1,77 @@
// Decompiled with JetBrains decompiler
// Type: UIXControls.DialogHelper
// Assembly: UIXControls, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
// MVID: 78800EA5-2757-404C-BA30-C33FCFC2852A
// Assembly location: C:\Program Files\Zune\UIXcontrols.dll
using Microsoft.Iris;
#nullable disable
namespace UIXControls
{
public class DialogHelper : ModelItem
{
private static string s_dialogCancel;
private static string s_dialogYes;
private static string s_dialogNo;
private static string s_dialogOk;
private string _contentUI;
private Command _cancel;
private bool _wouldLikeToBeHidden;
public static string DialogCancel
{
get => s_dialogCancel;
set => s_dialogCancel = value;
}
public static string DialogYes
{
get => s_dialogYes;
set => s_dialogYes = value;
}
public static string DialogNo
{
get => s_dialogNo;
set => s_dialogNo = value;
}
public static string DialogOk
{
get => s_dialogOk;
set => s_dialogOk = value;
}
public DialogHelper() : this(null)
{
}
public DialogHelper(string contentUI)
{
_contentUI = contentUI;
_cancel = new Command();
_cancel.Description = DialogCancel;
}
public string ContentUI => _contentUI;
public Command Cancel => _cancel;
public bool WouldLikeToBeHidden
{
get => _wouldLikeToBeHidden;
private set
{
if (_wouldLikeToBeHidden == value)
return;
_wouldLikeToBeHidden = value;
FirePropertyChanged(nameof(WouldLikeToBeHidden));
}
}
public void Hide() => WouldLikeToBeHidden = true;
public void Show() => CodeDialogManager.Instance.ShowCodeDialog(this);
}
}
+21
View File
@@ -0,0 +1,21 @@
// Decompiled with JetBrains decompiler
// Type: UIXControls.Helpers
// Assembly: UIXControls, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
// MVID: 78800EA5-2757-404C-BA30-C33FCFC2852A
// Assembly location: C:\Program Files\Zune\UIXcontrols.dll
using Microsoft.Iris;
#nullable disable
namespace UIXControls
{
public static class Helpers
{
public static bool IsModelItemDisposed(ModelItem item) => item.IsDisposed;
public static void AddUIXControlsClrRedirect()
{
Application.AddImportRedirect("res://UIXControls!", "clr-res://UIXControls!");
}
}
}
+45
View File
@@ -0,0 +1,45 @@
// Decompiled with JetBrains decompiler
// Type: UIXControls.MenuItemCommand
// Assembly: UIXControls, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
// MVID: 78800EA5-2757-404C-BA30-C33FCFC2852A
// Assembly location: C:\Program Files\Zune\UIXcontrols.dll
using Microsoft.Iris;
using System;
#nullable disable
namespace UIXControls
{
public class MenuItemCommand : Command
{
private bool _hidden;
public MenuItemCommand()
{
}
public MenuItemCommand(string description)
: base(null, description, null)
{
}
public bool Hidden
{
get => _hidden;
set
{
if (_hidden == value)
return;
_hidden = value;
FirePropertyChanged(nameof(Hidden));
}
}
public virtual bool ShouldHide() => Hidden;
public override string ToString()
{
return $"{GetType().Name}:\"{Description}\", Available = {Available}, Hidden = {Hidden}";
}
}
}
+263
View File
@@ -0,0 +1,263 @@
// Decompiled with JetBrains decompiler
// Type: UIXControls.MessageBox
// Assembly: UIXControls, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
// MVID: 78800EA5-2757-404C-BA30-C33FCFC2852A
// Assembly location: C:\Program Files\Zune\UIXcontrols.dll
using Microsoft.Iris;
using System;
#nullable disable
namespace UIXControls
{
public class MessageBox : DialogHelper
{
private string _title;
private string _message;
private bool _isOKDefault;
private Command _okCommand;
private Command _yesCommand;
private Command _noCommand;
private BooleanChoice _doNotAskMeAgain;
public string Title
{
get => _title;
set => _title = value;
}
public string Message
{
get => _message;
set => _message = value;
}
public Command Yes => _yesCommand;
public Command No => _noCommand;
public Command Ok => _okCommand;
public BooleanChoice DoNotAskMeAgain => _doNotAskMeAgain;
public bool IsOKDefault => _isOKDefault;
public static MessageBox Show(string title, string message, EventHandler okCommandHandler)
{
MessageBox dialog = new MessageBox(title, message, okCommandHandler, null, null, null, null);
ShowCodeDialog(dialog);
return dialog;
}
public static MessageBox Show(
string title,
string message,
EventHandler yesCommandHandler,
EventHandler noCommandHandler)
{
MessageBox dialog = new MessageBox(title, message, null, yesCommandHandler, noCommandHandler, null, null);
ShowCodeDialog(dialog);
return dialog;
}
public static MessageBox Show(
string title,
string message,
EventHandler okCommandHandler,
EventHandler yesCommandHandler,
EventHandler noCommandHandler,
EventHandler cancelCommandHandler)
{
MessageBox dialog = new MessageBox(title, message, okCommandHandler, yesCommandHandler, noCommandHandler, cancelCommandHandler, null);
ShowCodeDialog(dialog);
return dialog;
}
public static MessageBox Show(
string title,
string message,
EventHandler okCommandHandler,
EventHandler yesCommandHandler,
EventHandler noCommandHandler,
EventHandler cancelCommandHandler,
BooleanChoice doNotAskMeAgain)
{
MessageBox dialog = new MessageBox(title, message, okCommandHandler, yesCommandHandler, noCommandHandler, cancelCommandHandler, doNotAskMeAgain);
ShowCodeDialog(dialog);
return dialog;
}
public static MessageBox Show(
string title,
string message,
Command yesCommand,
Command noCommand,
BooleanChoice doNotAskMeAgain)
{
MessageBox dialog = new MessageBox(title, message, null, false, null, yesCommand, noCommand, null, doNotAskMeAgain);
ShowCodeDialog(dialog);
return dialog;
}
public static MessageBox ShowYesNo(string title, string message, Command yesCommand)
{
MessageBox dialog = new MessageBox(title, message, DialogNo, false, null, yesCommand, null, null, null);
ShowCodeDialog(dialog);
return dialog;
}
public static MessageBox Show(
string title,
string message,
Command okCommand,
BooleanChoice doNotAskMeAgain)
{
MessageBox dialog = new MessageBox(title, message, null, false, okCommand, null, null, null, doNotAskMeAgain);
ShowCodeDialog(dialog);
return dialog;
}
public static MessageBox Show(
string title,
string message,
Command okCommand,
string cancelText,
bool isOKDefault)
{
MessageBox dialog = new MessageBox(title, message, cancelText, isOKDefault, okCommand, null, null, null, null);
ShowCodeDialog(dialog);
return dialog;
}
public static MessageBox Show(
string title,
string message,
Command okCommand,
string cancelText,
EventHandler cancelCommand,
bool isOKDefault)
{
MessageBox dialog = new MessageBox(title, message, cancelText, isOKDefault, okCommand, null, null, cancelCommand, null);
ShowCodeDialog(dialog);
return dialog;
}
public static MessageBox Show(
string title,
string message,
string cancelText,
bool isOKDefault,
Command okCommand,
Command yesCommand,
Command noCommand,
EventHandler cancelCommand,
BooleanChoice doNotAskMeAgain)
{
MessageBox dialog = new MessageBox(title, message, cancelText, isOKDefault, okCommand, yesCommand, noCommand, cancelCommand, doNotAskMeAgain);
ShowCodeDialog(dialog);
return dialog;
}
public MessageBox()
: this(null, null)
{
}
protected MessageBox(string title, string message)
: base("res://UIXControls!Dialog.uix#MessageBoxContentUI")
{
_title = title;
_message = message;
}
protected MessageBox(
string title,
string message,
EventHandler okCommandHandler,
EventHandler yesCommandHandler,
EventHandler noCommandHandler,
EventHandler cancelCommandHandler,
BooleanChoice doNotAskMeAgain)
: this(title, message)
{
_doNotAskMeAgain = doNotAskMeAgain;
EventHandler eventHandler = new EventHandler(OnInvoked);
if (okCommandHandler == null && noCommandHandler == null)
{
if (yesCommandHandler == null)
{
Cancel.Description = DialogOk;
Cancel.Invoked += eventHandler;
}
else
Cancel.Description = DialogNo;
}
if (okCommandHandler != null)
{
_okCommand = new Command(this, DialogOk, okCommandHandler);
_okCommand.Invoked += eventHandler;
}
if (yesCommandHandler != null)
{
_yesCommand = new Command(this, DialogYes, yesCommandHandler);
_yesCommand.Invoked += eventHandler;
}
if (noCommandHandler != null)
{
_noCommand = new Command(this, DialogNo, noCommandHandler);
_noCommand.Invoked += eventHandler;
}
if (cancelCommandHandler == null)
return;
Cancel.Invoked += cancelCommandHandler;
}
protected MessageBox(
string title,
string message,
string cancelText,
bool isOKDefault,
Command okCommand,
Command yesCommand,
Command noCommand,
EventHandler cancelHandler,
BooleanChoice doNotAskMeAgain)
: this(title, message)
{
_doNotAskMeAgain = doNotAskMeAgain;
EventHandler eventHandler = new EventHandler(OnInvoked);
if (okCommand == null && yesCommand == null && noCommand == null && cancelHandler == null)
{
Cancel.Description = DialogOk;
Cancel.Invoked += eventHandler;
}
if (okCommand != null)
{
_okCommand = okCommand;
_okCommand.Invoked += eventHandler;
}
if (yesCommand != null)
{
_yesCommand = yesCommand;
_yesCommand.Invoked += eventHandler;
}
if (noCommand != null)
{
_noCommand = noCommand;
_noCommand.Invoked += eventHandler;
}
if (cancelHandler != null)
Cancel.Invoked += cancelHandler;
if (!string.IsNullOrEmpty(cancelText))
Cancel.Description = cancelText;
_isOKDefault = isOKDefault;
}
private void OnInvoked(object sender, EventArgs args) => Hide();
protected static void ShowCodeDialog(MessageBox dialog)
{
CodeDialogManager.Instance.ShowCodeDialog(dialog);
}
}
}
+50
View File
@@ -0,0 +1,50 @@
// Decompiled with JetBrains decompiler
// Type: UIXControls.OSInfo
// Assembly: UIXControls, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
// MVID: 78800EA5-2757-404C-BA30-C33FCFC2852A
// Assembly location: C:\Program Files\Zune\UIXcontrols.dll
using System.Runtime.InteropServices;
#nullable disable
namespace UIXControls
{
public static class OSInfo
{
private const uint SPI_GETKEYBOARDSPEED = 10;
private const uint SPI_GETKEYBOARDDELAY = 22;
private static int s_defaultKeyDelay = GetDefaultKeyDelay();
private static int s_defaultKeyRepeat = GetDefaultKeyRepeat();
public static bool IsCapsLockOn() => (GetKeyState(20U) & 1) != 0;
[DllImport("user32.dll")]
private static extern ushort GetKeyState(uint nVirtKey);
public static int DefaultKeyDelay => s_defaultKeyDelay;
public static int DefaultKeyRepeat => s_defaultKeyRepeat;
private static int GetDefaultKeyDelay()
{
int pParam;
if (!SystemParametersInfo(SPI_GETKEYBOARDDELAY, 0U, out pParam, 0))
pParam = 1;
return (pParam + 1) * 250;
}
private static int GetDefaultKeyRepeat()
{
if (!SystemParametersInfo(SPI_GETKEYBOARDSPEED, 0U, out int pParam, 0))
pParam = 1;
return 31000 / (62 + 28 * pParam);
}
[DllImport("user32.dll", SetLastError = true)]
private static extern bool SystemParametersInfo(
uint uiAction,
uint uiParam,
out int pParam,
int nWinIni);
}
}
+182
View File
@@ -0,0 +1,182 @@
// Decompiled with JetBrains decompiler
// Type: UIXControls.RegistryHelper
// Assembly: UIXControls, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
// MVID: 78800EA5-2757-404C-BA30-C33FCFC2852A
// Assembly location: C:\Program Files\Zune\UIXcontrols.dll
using Microsoft.Win32;
using System;
using System.Collections;
using System.Globalization;
using System.Text;
#nullable disable
namespace UIXControls
{
public class RegistryHelper
{
private static string s_settingsRegistryPath;
public static string SettingsRegistryPath
{
get => s_settingsRegistryPath;
set => s_settingsRegistryPath = value;
}
public static void SaveString(string keyName, string value)
{
if (string.IsNullOrEmpty(SettingsRegistryPath))
return;
Registry.SetValue(SettingsRegistryPath, keyName, value);
}
public static string GetString(string keyName, string defaultValue)
{
string str = null;
if (!string.IsNullOrEmpty(SettingsRegistryPath))
str = Registry.GetValue(SettingsRegistryPath, keyName, defaultValue) as string;
return str ?? defaultValue;
}
public static void SaveInt(string keyName, int value)
{
if (string.IsNullOrEmpty(SettingsRegistryPath))
return;
Registry.SetValue(SettingsRegistryPath, keyName, value);
}
public static int GetInt(string keyName, int min, int max, int defaultValue)
{
return string.IsNullOrEmpty(keyName) || string.IsNullOrEmpty(SettingsRegistryPath) || !(Registry.GetValue(SettingsRegistryPath, keyName, defaultValue) is int num) || num < min || num > max ? defaultValue : num;
}
private static void SaveList(string keyName, IList values, RegistryHelper.ToStringer toString)
{
if (string.IsNullOrEmpty(SettingsRegistryPath))
return;
StringBuilder stringBuilder = new StringBuilder();
foreach (object obj in (IEnumerable)values)
{
if (stringBuilder.Length > 0)
stringBuilder.Append(';');
stringBuilder.Append(toString(obj));
}
Registry.SetValue(SettingsRegistryPath, keyName, stringBuilder.ToString());
}
public static void SaveIntList(string keyName, IList values)
{
SaveList(keyName, values, value => ((int)value).ToString(NumberFormatInfo.InvariantInfo));
}
public static void SaveFloatList(string keyName, IList values)
{
SaveList(keyName, values, value => ((float)value).ToString(NumberFormatInfo.InvariantInfo));
}
private static IList GetList(
string keyName,
int expectedCount,
RegistryHelper.TryParser tryParse)
{
if (string.IsNullOrEmpty(SettingsRegistryPath))
return null;
string str = Registry.GetValue(SettingsRegistryPath, keyName, null) as string;
if (string.IsNullOrEmpty(str))
return null;
string[] strArray = str.Split(';');
if (strArray.Length != expectedCount)
return null;
ArrayList list = new ArrayList(expectedCount);
for (int index = 0; index < expectedCount; ++index)
{
object obj;
if (!tryParse(strArray[index], out obj))
return null;
list.Add(obj);
}
return list;
}
public static IList GetIntList(string keyName, int expectedCount)
{
return GetList(keyName, expectedCount, (string s, out object value) =>
{
int result;
bool intList = int.TryParse(s, NumberStyles.Integer, NumberFormatInfo.InvariantInfo, out result);
value = result;
return intList;
});
}
public static IList GetPositiveIntList(string keyName, int expectedCount)
{
IList positiveIntList = GetIntList(keyName, expectedCount);
if (positiveIntList != null)
{
foreach (int num in (IEnumerable)positiveIntList)
{
if (num <= 0)
{
positiveIntList = null;
break;
}
}
}
return positiveIntList;
}
public static IList GetReorderedIntList(string keyName, int expectedCount)
{
IList reorderedIntList = GetIntList(keyName, expectedCount);
if (reorderedIntList != null)
{
BitArray bitArray = new BitArray(expectedCount);
foreach (int index in (IEnumerable)reorderedIntList)
{
if (index < 0 || index >= expectedCount || bitArray[index])
{
reorderedIntList = null;
break;
}
bitArray[index] = true;
}
}
return reorderedIntList;
}
public static IList GetFloatList(string keyName, int expectedCount)
{
return GetList(keyName, expectedCount, (string s, out object value) =>
{
float result;
bool floatList = float.TryParse(s, NumberStyles.Float, NumberFormatInfo.InvariantInfo, out result);
value = result;
return floatList;
});
}
public static IList GetPositionList(string keyName, int expectedCount)
{
IList positionList = GetFloatList(keyName, expectedCount);
if (positionList != null)
{
float num1 = 0.0f;
foreach (float num2 in (IEnumerable)positionList)
{
if ((double)num2 < (double)num1 || (double)num2 > 1.0)
{
positionList = null;
break;
}
num1 = num2;
}
}
return positionList;
}
private delegate string ToStringer(object value);
private delegate bool TryParser(string s, out object value);
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 354 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 365 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 372 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 370 B

Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 525 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 514 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 381 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 399 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 397 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 401 B

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More