Esempio n. 1
0
        private void ButtonColor_Click(object sender, RoutedEventArgs e)
        {
            Brush brush = CellColor.ChangeColor();

            (sender as Button).Background = brush;
            (sender as Button).Content    = CellColor.GetColorName();
        }
Esempio n. 2
0
        public void SetCellColor(int index)
        {
            string tag = this.GetTag(index);

            CellColor.SetCellColor(tag);

            RefreshBrush(tag, index);
        }
Esempio n. 3
0
        public void InitHighLow()
        {
            for (int i = 0; i < 7; i++)
            {
                string tag  = this.GetTag(i);
                int    code = CellColor.GetCellColorCode(tag);

                RefreshBrush(tag, i);
            }
        }
Esempio n. 4
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            CellColor.LoadColoring();

            int dCount = 0;

            for (int i = 1; i <= 20; i++)
            {
                DateTime d = new DateTime(DateTime.Now.Year, DateTime.Now.Month, i);
                if (d.DayOfWeek == DayOfWeek.Thursday)
                {
                    dCount++;
                }
                if (dCount == 2)
                {
                    dCount = i;
                    break;
                }
            }

            int gap = DateTime.Now.Day > dCount ? 1 : 0;

            List <KeyValuePair <string, string> > list = new List <KeyValuePair <string, string> >();

            for (int i = gap; i <= 3 + gap; i++)
            {
                DateTime date = DateTime.Now.AddMonths(i);
                list.Add(new KeyValuePair <string, string>(
                             String.Format("{0}년 {1:D2}월", date.Year, date.Month),
                             String.Format("{0}{1:D2}", date.Year, date.Month)
                             ));

                comboDate.DisplayMemberPath = "Key";
                comboDate.SelectedValuePath = "Value";
                comboDate.ItemsSource       = list;
            }

            comboDate.SelectedIndex     = 0;
            comboDate.SelectionChanged += comboDate_SelectionChanged;
            ConnectToServer();
        }
Esempio n. 5
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            try {
                DataRecord dr  = value as DataRecord;
                double     val = 0;

                switch (parameter.ToString())
                {
                case "DateFore":
                    return(BrushZero);

                case "OpenFore":
                    val = System.Convert.ToDouble(dr.Open) - dr.BeforeClose;
                    break;

                case "HighFore":
                    val = dr.HighRaw - dr.BeforeClose;
                    break;

                case "LowFore":
                    val = dr.LowRaw - dr.BeforeClose;
                    break;

                case "CloseFore":
                case "ChangeFore":
                    int diff = dr.GetChange();
                    switch (diff)
                    {
                    case 1: return(BrushUp);

                    case -1: return(BrushDown);

                    default: return(BrushZero);
                    }

                case "DiffFore":
                    val = System.Convert.ToDouble(dr.Diff);
                    break;

                case "DateBack":
                    return(CellColor.GetCellColorCode(dr.GetTag(0)));

                    break;

                case "OpenBack":
                    return(BrushNone);

                    break;

                case "HighBack":
                    return(BrushNone);

                    break;

                case "LowBack":
                    return(BrushNone);

                    break;

                case "CloseBack":
                    return(BrushNone);

                    break;

                case "ChangeBack":
                    return(BrushNone);

                    break;

                case "DiffBack":
                    return(BrushNone);

                    break;

/*
 *                                      case 7:
 *                                              SolidColorBrush salmon = new SolidColorBrush(Colors.LightSalmon) { Opacity = 0.6 };
 *                                              return dr.IsHigh ? salmon : Brushes.Transparent;
 *                                      case 8:
 *                                              SolidColorBrush skyblue = new SolidColorBrush(Colors.LightSkyBlue) { Opacity = 0.4 };
 *                                              return dr.IsLow ? skyblue : Brushes.Transparent;
 */
                }

                if (val > 0)
                {
                    return(BrushUp);
                }
                else if (val < 0)
                {
                    return(BrushDown);
                }
                else
                {
                    return(BrushZero);
                }
            } catch {
                return(BrushError);
            }
        }
Esempio n. 6
0
        private void RefreshBrush(string tag, int index)
        {
            int code = CellColor.GetCellColorCode(tag);

            Brush brush = Brushes.Transparent;

            if (code == 0)
            {
                if (index == 2 && this.IsHigh)
                {
                    brush = new SolidColorBrush(Colors.LightSalmon)
                    {
                        Opacity = 0.8
                    };
                }
                else if (index == 3 && this.IsLow)
                {
                    brush = new SolidColorBrush(Colors.LightSkyBlue)
                    {
                        Opacity = 0.8
                    };
                }
            }
            else
            {
                brush = CellColor.GetCellBrush(code);
            }

            switch (index)
            {
            case 0:
                DateBrush = brush;
                break;

            case 1:
                OpenBrush = brush;
                break;

            case 2:
                HighBrush = brush;
                break;

            case 3:
                LowBrush = brush;
                break;

            case 4:
                CloseBrush = brush;
                break;

            case 5:
                ChangeBrush = brush;
                break;

            case 6:
                DiffBrush = brush;
                break;

            default: return;
            }

            OnPropertyChanged(String.Format("{0}Brush", FieldArray[index]));
        }
Esempio n. 7
0
 private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     CellColor.SaveColoring();
     xaSession.session.DisconnectServer();
 }