示例#1
0
        /// <summary>
        /// Updates the combobox select
        /// </summary>
        private async void getAllLinesAsync()
        {
            var model = new UserlineModel(stock);
            Task <List <UserLines> > task = Task.Run(() => model.getAllUserlines());
            var userlines = await task;

            this.userlines = userlines;
        }
示例#2
0
        /// <summary>
        /// Draws trend lines asynchronously
        /// </summary>
        private async void drawLinesAsync()
        {
            mainForm.notifyUser(FrmMain.NotifyType.PrepareMessage, "Userlines werden geladen...");

            var model = new UserlineModel(stock);
            Task <List <UserLines> > task = Task.Run(() => model.getAllUserlines());
            var userlines = await task;

            if (userlines != null)
            {
                foreach (var userline in userlines)
                {
                    var pointStart = new DataPoint(userline.TimePoint1, userline.PricePoint1);
                    var pointEnd   = new DataPoint(userline.TimePoint2, userline.PricePoint2);
                    var color      = ColorTranslator.FromHtml(userline.LineColor);

                    var line = new Series("Line_" + pointNr);
                    line.ChartType   = SeriesChartType.Line;
                    line.BorderWidth = (int)userline.Thickness;
                    line.Color       = color;
                    line.Tag         = userline;

                    line.Points.Add(pointStart);
                    line.Points[0].MarkerSize  = (int)(userline.Thickness * 2);
                    line.Points[0].MarkerStyle = MarkerStyle.Circle;
                    line.Points.Add(pointEnd);
                    line.Points[1].MarkerSize  = (int)(userline.Thickness * 2);
                    line.Points[1].MarkerStyle = MarkerStyle.Circle;

                    chartStock.Series.Add(line);

                    pointNr += 2;
                }
            }

            mainForm.notifyUser(FrmMain.NotifyType.StatusMessage, "Bereit");
        }