ChartManager.cs 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. using System.Collections.Generic;
  2. namespace Muchinfo.MTPClient.UI.Utilities
  3. {
  4. public class ChartManager
  5. {
  6. private static Dictionary<string, int> _customMinutes = new Dictionary<string, int>();
  7. /// <summary>
  8. /// Gets the current custom minute.
  9. /// </summary>
  10. /// <param name="windowKey">The window key.</param>
  11. /// <returns>System.Int32.</returns>
  12. public static int GetCurrentCustomMinute(string windowKey)
  13. {
  14. if (_customMinutes.ContainsKey(windowKey))
  15. {
  16. return _customMinutes[windowKey];
  17. }
  18. return 0;
  19. }
  20. /// <summary>
  21. /// Adds the custom minute.
  22. /// </summary>
  23. /// <param name="windowKey">The window key.</param>
  24. /// <param name="minute">The minute.</param>
  25. public static void AddOrUpdateCustomMinute(string windowKey, int minute)
  26. {
  27. if (_customMinutes.ContainsKey(windowKey))
  28. {
  29. _customMinutes[windowKey] = minute;
  30. }
  31. else
  32. {
  33. _customMinutes.Add(windowKey, minute);
  34. }
  35. }
  36. /// <summary>
  37. /// Removes the custom minute.
  38. /// </summary>
  39. /// <param name="windowKey">The window key.</param>
  40. public static void RemoveCustomMinute(string windowKey)
  41. {
  42. if (_customMinutes.ContainsKey(windowKey))
  43. {
  44. _customMinutes.Remove(windowKey);
  45. }
  46. }
  47. /// <summary>
  48. /// Gets the active view custom minute.
  49. /// </summary>
  50. /// <returns>System.Int32.</returns>
  51. public static int GetActiveViewCustomMinute()
  52. {
  53. return 0;
  54. //var activeChartView = WindowHelper.GetWindow(WindowType.QuoteChartView);
  55. //if (activeChartView == null) return 1;
  56. //var key = activeChartView.WindowItem.WindowKey;
  57. //return GetCurrentCustomMinute(key);
  58. }
  59. }
  60. }