QuikTimeSpanConverter.cs 4.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. using MuchInfo.Chart.Data.EnumTypes;
  2. using MuchInfo.Chart.WPF.Helpers;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Windows.Data;
  8. //----------------------------------------------------------------
  9. //Module Name: QuikTimeSpanConverter
  10. //Purpose:
  11. //CopyRight: Muchinfo
  12. //History:
  13. //----------------------------------------------------------------
  14. //DateTime 2015/4/8 11:41:18
  15. //Author ouyang.hongbin
  16. //Description Create
  17. //----------------------------------------------------------------
  18. namespace MuchInfo.Chart.WPF.Converter
  19. {
  20. public class QuikTimeSpanConverter : IValueConverter
  21. {
  22. public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  23. {
  24. var Rlt = "";
  25. var cycle = (CycleType)value;
  26. switch (cycle)
  27. {
  28. case CycleType.TimeSharing:
  29. Rlt = LanguageManager.FindResource(LanguageConst.TimeSpanControl_TimeSharingLine);
  30. break;
  31. case CycleType.Minute:
  32. Rlt = LanguageManager.FindResource(LanguageConst.TimeSpanControl_OneMinute);
  33. break;
  34. case CycleType.Minute3:
  35. Rlt = LanguageManager.FindResource(LanguageConst.TimeSpanControl_ThreeMinute);
  36. break;
  37. case CycleType.Minute5:
  38. Rlt = LanguageManager.FindResource(LanguageConst.TimeSpanControl_FiveMinute);
  39. break;
  40. case CycleType.Minute10:
  41. Rlt = LanguageManager.FindResource(LanguageConst.TimeSpanControl_TenMinute);
  42. break;
  43. case CycleType.Minute15:
  44. Rlt = LanguageManager.FindResource(LanguageConst.TimeSpanControl_FifteenMinute);
  45. break;
  46. case CycleType.Minute30:
  47. Rlt = LanguageManager.FindResource(LanguageConst.TimeSpanControl_ThirtyMinute);
  48. break;
  49. case CycleType.Minute60:
  50. Rlt = LanguageManager.FindResource(LanguageConst.TimeSpanControl_SixtyMinute);
  51. break;
  52. case CycleType.Minute90:
  53. Rlt = LanguageManager.FindResource(LanguageConst.TimeSpanControl_NinetyMinute);
  54. break;
  55. case CycleType.Minute120:
  56. Rlt = LanguageManager.FindResource(LanguageConst.TimeSpanControl_Minute120);
  57. break;
  58. case CycleType.Minute180:
  59. Rlt = LanguageManager.FindResource(LanguageConst.TimeSpanControl_Minute180);
  60. break;
  61. case CycleType.Minute240:
  62. Rlt = LanguageManager.FindResource(LanguageConst.TimeSpanControl_Minute240);
  63. break;
  64. case CycleType.Hour:
  65. Rlt = LanguageManager.FindResource(LanguageConst.TimeSpanControl_OneHour);
  66. break;
  67. case CycleType.Day:
  68. Rlt = LanguageManager.FindResource(LanguageConst.TimeSpanControl_OneDay);
  69. break;
  70. case CycleType.Week:
  71. Rlt = LanguageManager.FindResource(LanguageConst.TimeSpanControl_OneWeek);
  72. break;
  73. case CycleType.Month:
  74. Rlt = LanguageManager.FindResource(LanguageConst.TimeSpanControl_OneMonth);
  75. break;
  76. case CycleType.Quarter:
  77. Rlt = LanguageManager.FindResource(LanguageConst.TimeSpanControl_OneQuarter);
  78. break;
  79. case CycleType.Year:
  80. Rlt = LanguageManager.FindResource(LanguageConst.TimeSpanControl_OneYear);
  81. break;
  82. }
  83. return Rlt;
  84. }
  85. public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  86. {
  87. throw new NotImplementedException();
  88. }
  89. }
  90. }