コード例 #1
0
 public void testClass()
 {
     line              = new ColorLine();
     line.AllowDrag    = true;
     line.Pen.Color    = Color.Red;
     line.EndDragLine += lineDragHandler;
 }
コード例 #2
0
 private void AddAlarmLineToTrendChart(float[] alarms, TChart trendChart, bool isRepairChart = false)
 {
     if (alarms == null)
     {
         return;
     }
     if (isRepairChart)
     {
         for (int i = 1; i < trendChart.Tools.Count; i++)
         {
             trendChart.Tools.RemoveAt(i);
         }
     }
     else
     {
         trendChart.Tools.Clear();
     }
     for (int i = 0; i < alarms.Length; i++)
     {
         var alarmLine = new ColorLine();
         alarmLine.Pen.Color = DailyReportItem.AlarmColors[i];
         alarmLine.Pen.Style = DashStyle.Dash;
         alarmLine.Axis      = trendChart.Axes.Left;
         alarmLine.Value     = alarms[i];
         trendChart.Tools.Add(alarmLine);
     }
 }
コード例 #3
0
        /// <summary>
        /// The initialize chart.
        /// </summary>
        private void InitializeChart()
        {
            this.ChartControl.Aspect.View3D  = false;
            this.ChartControl.Header.Visible = false;
            this.ChartControl.Legend.Visible = true;

            this.ChartControl.Panel.Bevel.Outer            = BevelStyles.None;
            this.ChartControl.Panel.Bevel.Inner            = BevelStyles.None;
            this.ChartControl.Panel.Brush.Gradient.Visible = false;

            this.ChartControl.Walls.Back.Bevel.Inner = BevelStyles.None;
            this.ChartControl.Walls.Back.Bevel.Outer = BevelStyles.None;

            this.ChartControl.Axes.Left.Visible          = true;
            this.ChartControl.Axes.Left.Title.Text       = "Amp.";
            this.ChartControl.Axes.Left.AxisPen.Width    = 1;
            this.ChartControl.Axes.Left.Labels.Visible   = true;
            this.ChartControl.Axes.Left.AutomaticMinimum = false;
            this.ChartControl.Axes.Left.AutomaticMaximum = false;
            this.ChartControl.Axes.Left.SetMinMax(-1, 15);
            this.ChartControl.Axes.Left.Labels.AutoSize   = false;
            this.ChartControl.Axes.Left.Labels.TextAlign  = TextAlignment.Left;
            this.ChartControl.Axes.Left.Labels.CustomSize = 30;

            this.ChartControl.Axes.Bottom.Title.Text     = "T[s]";
            this.ChartControl.Axes.Bottom.Visible        = true;
            this.ChartControl.Axes.Bottom.AxisPen.Width  = 1;
            this.ChartControl.Axes.Bottom.Labels.Visible = true;
            this.ChartControl.Axes.Bottom.Visible        = true;
            this.ChartControl.Axes.Bottom.Inverted       = true;
            this.ChartControl.Axes.Bottom.SetMinMax(0, cMaxXValue);

            this.ChartControl.Panel.MarginRight = 4.5;

            var seriesForward = new Line {
                Color = Colors.Blue, Title = "ValuesForward"
            };

            seriesForward.XValues.DataMember = "Index";
            seriesForward.YValues.DataMember = "Value";
            seriesForward.ShowInLegend       = false;
            seriesForward.LinePen.Width      = 2;
            seriesForward.Pointer.Visible    = true;
            seriesForward.Pointer.Style      = PointerStyles.Circle;
            seriesForward.Pointer.Color      = Colors.Blue;
            this.ChartControl.Series.Add(seriesForward);

            var thresholdMinLine = new ColorLine {
                Pen = { Color = Colors.Yellow }, Axis = this.ChartControl.Axes.Left, AllowDrag = false
            };

            this.ChartControl.Tools.Add(thresholdMinLine);

            var thresholdMaxLine = new ColorLine {
                Pen = { Color = Colors.Red }, Axis = this.ChartControl.Axes.Left, AllowDrag = false
            };

            this.ChartControl.Tools.Add(thresholdMaxLine);
        }
コード例 #4
0
        public override string GenerateNameBySettings()
        {
            string colorStr;

            GetKnownColor(ColorLine.ToArgb(), out colorStr);
            return(string.Format("CCI[{0}]{1}",
                                 Period, string.IsNullOrEmpty(colorStr) ? "" : string.Format("({0})", colorStr)));
        }
コード例 #5
0
 private static void CommandInfo(ICommand cmdObj)
 {
     Console.WriteLine("\\ Name: " + cmdObj.Name);
     Console.Write(" |Author: "); ColorLine.WriteLineC(cmdObj.Author, Green);
     Console.Write(" |Type: "); ColorLine.WriteLineC(cmdObj.Type, Yellow);
     Console.Write(" |Command: "); ColorLine.WriteLineC(cmdObj.Cmd, Cyan);
     Console.Write(" `Description: " + cmdObj.Description + "\r\n");
     Console.WriteLine();
 }
        private void InitializeChart()
        {
            tChart1.Frame = this.View.Frame;

            tChart1.Header.Text       = "Scroll Pager Tool";
            tChart1.Panning.Active    = true;
            tChart1.Series.Add(series = new FastLine());
            series.FillSampleValues(1000);

            tChart1.Tools.Add(tool = new ScrollPager());

            for (int i = 0; i < tChart1.Series.Count; i++)
            {
                if (tChart1.Series[i].Count > 0)
                {
                    tool.Series = tChart1.Series[i];
                }
            }

            tool.ColorBandTool.StartLine.AllowDrag = true;
            tool.ColorBandTool.EndLine.AllowDrag   = true;
            tool.ColorBandTool.StartLine.Active    = true;
            tool.ColorBandTool.EndLine.Active      = true;


            tChart1.Tools.Add(colorlinetool = new ColorLine());
            colorlinetool.Value             = 100;
            colorlinetool.AllowDrag         = true;
            colorlinetool.Pen.Color         = Color.Blue;

            tChart1.ClickBackground += TChart1_ClickBackground;

            tChart1.Tools.Add(point    = new NearestPoint());
            tChart1.Tools.Add(annotate = new Annotation());

            point.Brush.Color = tool.PointerHighlightColor;
            point.DrawLine    = false;
            point.Size        = 6;
            point.Direction   = NearestPointDirection.Horizontal;
            point.Series      = series;
            point.Change     += Point_Change;

            annotate.Position             = AnnotationPositions.RightTop;
            annotate.Text                 = "YValue:";
            annotate.Shape.Shadow.Visible = false;
            annotate.Shape.Font.Color     = Color.Red;
            annotate.Shape.Color          = tool.PointerHighlightColor;
            annotate.Shape.Font.Size      = 15;
            annotate.Shape.Pen.Visible    = false;
            annotate.Shape.Transparent    = true;
            annotate.TextAlign            = CoreText.CTTextAlignment.Center;

            tChart1.Panel.Gradient.Visible = false;

            this.View.AddSubview(tChart1);
        }
コード例 #7
0
 internal void ReadyString()
 {
     ColorLine.WriteC(Environment.UserName, Green);
     ColorLine.WriteC("@", Magenta);
     //Console.Write("M:");
     ColorLine.WriteC(Environment.MachineName, Cyan);
     Console.Write(" Dir: ");
     ColorLine.WriteLineC(CurrentDirectory.FullName, Yellow);
     Console.Write("$> ");
 }
コード例 #8
0
ファイル: PencilTool.cs プロジェクト: apokrovskyi/KPInt
        private void StartDrawing(Point start)
        {
            _clickTool.MouseUp      += Input_MouseUp;
            _input.PreviewMouseMove += Input_PreviewMouseMove;
            _clickTool.MouseEnter   += Input_MouseEnter;
            _input.MouseLeave       += Input_MouseLeave;

            _drawnLine     = new ColorLine(start, start, _getColor(), 0);
            _drawStartTime = DateTime.Now;
        }
コード例 #9
0
ファイル: ByteIO.cs プロジェクト: apokrovskyi/KPInt
 public ByteArrayWriter Append(ColorLine colorLine)
 {
     Append((int)colorLine.Start.X);
     Append((int)colorLine.Start.Y);
     Append((int)colorLine.End.X);
     Append((int)colorLine.End.Y);
     Append(colorLine.Color.R);
     Append(colorLine.Color.G);
     Append(colorLine.Color.B);
     Append(colorLine.Thickness);
     return(this);
 }
コード例 #10
0
        public ColorLine AddColorLine(TChart objChart, Axis axis, Color lineColor, System.Drawing.Drawing2D.DashStyle dashStyle)
        {
            ColorLine colorLine = new ColorLine();

            objChart.Tools.Add(colorLine);

            colorLine.Axis      = axis;
            colorLine.Pen.Color = lineColor;
            colorLine.Pen.Style = dashStyle;

            return(colorLine);
        }
コード例 #11
0
        private void InitializeChart()
        {
            tChart1.Chart.Header.Text       = "Scroll Pager Tool";
            tChart1.Chart.Panning.Active    = true;
            tChart1.Chart.Series.Add(series = new FastLine());
            series.FillSampleValues(1000);

            tChart1.Chart.Tools.Add(tool = new ScrollPager());

            for (int i = 0; i < tChart1.Chart.Series.Count; i++)
            {
                if (tChart1.Chart.Series[i].Count > 0)
                {
                    tool.Series = tChart1.Chart.Series[i];
                }
            }

            tool.ColorBandTool.StartLine.AllowDrag = true;
            tool.ColorBandTool.EndLine.AllowDrag   = true;
            tool.ColorBandTool.StartLine.Active    = true;
            tool.ColorBandTool.EndLine.Active      = true;


            tChart1.Chart.Tools.Add(colorlinetool = new ColorLine());
            colorlinetool.Value     = 100;
            colorlinetool.AllowDrag = true;
            colorlinetool.Pen.Color = Color.Blue;

            tChart1.Chart.ClickBackground += TChart1_ClickBackground;

            tChart1.Chart.Tools.Add(point    = new NearestPoint());
            tChart1.Chart.Tools.Add(annotate = new Annotation());

            point.Brush.Color = tool.PointerHighlightColor;
            point.DrawLine    = false;
            point.Size        = 6;
            point.Direction   = NearestPointDirection.Horizontal;
            point.Series      = series;
            point.Change     += new EventHandler(point_Change);

            annotate.Position             = AnnotationPositions.RightTop;
            annotate.Text                 = "YValue:";
            annotate.Shape.Shadow.Visible = false;
            annotate.Shape.Font.Color     = tChart1.Chart.Header.Font.Color;
            annotate.Shape.Color          = tool.PointerHighlightColor;
            annotate.Shape.Pen.Visible    = false;
            annotate.Shape.Font.Color     = Color.White;
            annotate.TextAlign            = TextAlignment.Center;

            //Theme.ApplyChartTheme(typeof(FlatTheme), tool.SubChartTChart.Chart);
        }
コード例 #12
0
        internal static bool IsURLExist(string url)
        {
            bool valid = false;

            try
            {
                WebRequest  req = WebRequest.Create(url);
                WebResponse res = req.GetResponse();
                res.Close();
                valid = true;
            }
            catch (WebException ex)
            {
                Console.Write(" =====> "); ColorLine.WriteLineC(" ### " + ex.Message, Red);
            }
            return(valid);
        }
コード例 #13
0
        public static void DoAGetRequest(string link, string nFileFix)
        {
            Uri uri = new Uri(link);

            // Construct HTTP request to get the file
            Console.Write("--- Dowloading: "); ColorLine.WriteLineC(Path.GetFileName(link), Yellow);
            using (WebClient client = new WebClient())
            {
                try
                {
                    // Specify that the DownloadFileCallback method gets called
                    // Specify a progress notification handler.
                    client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(DownloadProgressCallback);
                    // when the download completes.
                    //client.DownloadFileCompleted += new AsyncCompletedEventHandler(DownloadFileCallback);
                    client.DownloadFileAsync(new Uri(link), nFileFix);
                }
                catch (Exception ex) { /* Program.pL.Percent = -1; */ ColorLine.WriteLineC(" ### Error # \r\n" + ex.Message, Red); }
            }
        }
コード例 #14
0
        public void DrawLine(ColorLine line)
        {
            if (line.Thickness == 0)
            {
                return;
            }

            _control.BaseCanvas.Children.Add(new Line
            {
                X1                 = line.Start.X,
                Y1                 = line.Start.Y,
                X2                 = line.End.X,
                Y2                 = line.End.Y,
                Stroke             = new SolidColorBrush(line.Color),
                StrokeThickness    = line.Thickness,
                Visibility         = Visibility.Visible,
                StrokeStartLineCap = PenLineCap.Round,
                StrokeEndLineCap   = PenLineCap.Round
            });
        }
コード例 #15
0
        /// <summary>
        /// save to file
        /// сохранить в файл
        /// </summary>
        public void Save()
        {
            try
            {
                using (StreamWriter writer = new StreamWriter(@"Engine\" + Name + @"Alert.txt", false))
                {
                    writer.WriteLine(Type);

                    string saveLineString = "";

                    for (int i = 0; i < Lines.Length; i++)
                    {
                        saveLineString += Lines[i].GetStringToSave() + "%";
                    }

                    writer.WriteLine(saveLineString);

                    writer.WriteLine(Label);
                    writer.WriteLine(Message);
                    writer.WriteLine(BorderWidth);
                    writer.WriteLine(IsOn);
                    writer.WriteLine(IsMusicOn);
                    writer.WriteLine(IsMessageOn);
                    writer.WriteLine(ColorLine.ToArgb());
                    writer.WriteLine(ColorLabel.ToArgb());
                    writer.WriteLine(Music);
                    writer.WriteLine(SignalType);
                    writer.WriteLine(VolumeReaction);
                    writer.WriteLine(Slippage);
                    writer.WriteLine(NumberClosePosition);
                    writer.WriteLine(OrderPriceType);
                    writer.Close();
                }
            }
            catch (Exception)
            {
                // ignore
            }
        }
コード例 #16
0
 public void SincePrintProgress()
 {
     Console.CursorVisible = false;
     Console.Write(" =====> ");
     while (Percent <= stepProgress)
     {
         if (stepProgress == Percent)
         {
             stepProgress = 99;
         }
         // Generate new state
         int width = (int)(Percent / 100 * barLength);
         int fill  = barLength - width;
         //Delete Last String
         string clear = string.Empty.PadRight(LastOutputLength, '\b');
         Console.Write(clear);
         Console.Write((Percent < 10 ? "  " : (Percent >= 10 && Percent < 100) ? " " : "") + "{0:0.0}% [ ", Percent); ColorLine.WriteC(string.Empty.PadLeft(width, '█'), Green); Console.Write("{0} ] - ", string.Empty.PadLeft(fill, ' '));
         LastOutputLength = 5 + "% [ ".Length + barLength + " ] - ".Length;
     }
     ColorLine.WriteC(" DONE", Green); Console.WriteLine('!');
     Console.CursorVisible = true;
 }
コード例 #17
0
 private static void DownloadFileCallback(object sender, AsyncCompletedEventArgs e)
 {
     ColorLine.WriteC(" DONE", Green); Console.WriteLine("!");
 }
コード例 #18
0
 public void AddLogEntry(string text, ColorLine colorLine)
 {
     ConsoleLogEntry.PrintTextLine(text, colorLine);
 }
コード例 #19
0
        public void UpdatePrintProgress(double PercentUp)
        {
            Console.CursorVisible = false;
            // Generate new state
            int width = (int)(PercentUp / 100 * barLength);
            int fill  = barLength - width;
            //Delete Last String
            string clear = string.Empty.PadRight(LastOutputLength, '\b');

            Console.Write(clear);
            if (true)
            {
                Console.Write((Percent < 10 ? "  " : (PercentUp >= 10 && PercentUp < 100) ? " " : "") + "{0:0}% [ ", PercentUp); ColorLine.WriteC(string.Empty.PadLeft(width, '█'), Green); Console.Write("{0} ] - ", string.Empty.PadLeft(fill, ' '));
                LastOutputLength = 3 + "% [ ".Length + barLength + " ] - ".Length;
            }
        }
コード例 #20
0
ファイル: DrawingToolsVM.cs プロジェクト: apokrovskyi/KPInt
 private void ChangeLine(ColorLine line)
 {
     DrawnLine = line;
     LineDrawn?.Invoke();
 }
コード例 #21
0
        public void SaveInXML(XmlElement parentNode, CandleChartControl owner)
        {
            var node = parentNode.AppendChild(parentNode.OwnerDocument.CreateElement("Asterisk"));

            node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("Name")).Value = Name;

            node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("Text")).Value  = Text;
            node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("Sign")).Value  = Sign;
            node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("magic")).Value = Magic.ToString();

            node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("ColorLine")).Value = ColorLine.ToArgb().ToString();
            node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("ColorFill")).Value = ColorFill.ToArgb().ToString();
            node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("ColorText")).Value = ColorText.ToArgb().ToString();

            node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("Price")).Value = Price.ToString(CultureProvider.Common);
            if (DateStart.HasValue)
            {
                node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("PivotTime")).Value =
                    DateStart.Value.ToString("ddMMyyyy HHmmss", CultureProvider.Common);
            }
            node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("Shape")).Value        = Shape.ToString();
            node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("Transparency")).Value =
                Transparency.ToString();
            node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("TransparencyText")).Value =
                TransparencyText.ToString();
            node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("Radius")).Value =
                Radius.ToString();
            node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("magic")).Value = Magic.ToString();
        }
コード例 #22
0
ファイル: PencilTool.cs プロジェクト: apokrovskyi/KPInt
 private void ChangeLine(Point end)
 {
     _drawnLine = new ColorLine(_drawnLine.End, end, _getColor(), (byte)Thickness);
     _output(_drawnLine);
 }