| | |
| | | using Panuon.WPF.UI; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | |
| | | namespace HMI.UI.Util |
| | | { |
| | | public class MaskHolder |
| | | { |
| | | private static Dictionary<WindowX, List<object>> Container; |
| | | private static Dictionary<object, WindowX> ReverseContainer; |
| | | //public class MaskHolder |
| | | //{ |
| | | // private static Dictionary<WindowX, List<object>> Container; |
| | | // private static Dictionary<object, WindowX> ReverseContainer; |
| | | |
| | | public static void AddMask(WindowX window, object source) |
| | | { |
| | | if (Container.ContainsKey(window)) |
| | | { |
| | | Container[window].Add(source); |
| | | } |
| | | else |
| | | { |
| | | Container[window] = new List<object> { source }; |
| | | } |
| | | ReverseContainer.Add(source, window); |
| | | window.IsMaskVisible = true; |
| | | } |
| | | // public static void AddMask(WindowX window, object source) |
| | | // { |
| | | // if (Container.ContainsKey(window)) |
| | | // { |
| | | // Container[window].Add(source); |
| | | // } |
| | | // else |
| | | // { |
| | | // Container[window] = new List<object> { source }; |
| | | // } |
| | | // ReverseContainer.Add(source, window); |
| | | // window.IsMaskVisible = true; |
| | | // } |
| | | |
| | | public static void RemoveMask(object source) |
| | | { |
| | | if (!ReverseContainer.ContainsKey(source)) |
| | | { |
| | | return; |
| | | } |
| | | WindowX win = ReverseContainer[source]; |
| | | if (!Container.ContainsKey(win) || Container[win] == null || Container[win].Count <= 0) |
| | | { |
| | | win.IsMaskVisible = false; |
| | | } |
| | | ReverseContainer.Remove(source); |
| | | } |
| | | } |
| | | // public static void RemoveMask(object source) |
| | | // { |
| | | // if (!ReverseContainer.ContainsKey(source)) |
| | | // { |
| | | // return; |
| | | // } |
| | | // WindowX win = ReverseContainer[source]; |
| | | // if (!Container.ContainsKey(win) || Container[win] == null || Container[win].Count <= 0) |
| | | // { |
| | | // win.IsMaskVisible = false; |
| | | // } |
| | | // ReverseContainer.Remove(source); |
| | | // } |
| | | //} |
| | | } |