Ejemplo n.º 1
0
        public override void OnStrategyStart()
        {
            kdj = KDJ.create(Bars, 10, BarData.Close);
            kdj.Color = Color.Green;
            kdj.K.Color = Color.White;
            kdj.D.Color = Color.Yellow;
            Draw(kdj, 2);
            Draw(kdj.K, 2);
            Draw(kdj.D, 2);

            line80 = new HorizontalLine(Bars, 80);
            line80.Color = Color.Red;
            Draw(line80, 2);

            line20 = new HorizontalLine(Bars, 20);
            line20.Color = Color.Green;
            Draw(line20, 2);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Build the pulsar pattern.
        /// </summary>
        protected override void Build()
        {
            var vLine = new VerticalLine(3);
            var hLine = new HorizontalLine(3);

            PatternBuilder.Place(vLine, Cells, 2, 0);
            PatternBuilder.Place(vLine, Cells, 8, 0);
            PatternBuilder.Place(vLine, Cells, 2, 5);
            PatternBuilder.Place(vLine, Cells, 8, 5);
            PatternBuilder.Place(vLine, Cells, 2, 7);
            PatternBuilder.Place(vLine, Cells, 8, 7);
            PatternBuilder.Place(vLine, Cells, 2, 12);
            PatternBuilder.Place(vLine, Cells, 8, 12);

            PatternBuilder.Place(hLine, Cells, 0, 2);
            PatternBuilder.Place(hLine, Cells, 0, 8);
            PatternBuilder.Place(hLine, Cells, 5, 2);
            PatternBuilder.Place(hLine, Cells, 5, 8);
            PatternBuilder.Place(hLine, Cells, 7, 2);
            PatternBuilder.Place(hLine, Cells, 7, 8);
            PatternBuilder.Place(hLine, Cells, 12, 2);
            PatternBuilder.Place(hLine, Cells, 12, 8);
        }
Ejemplo n.º 3
0
        private static void DisplayApplicationHeader()
        {
            CustomConsole.WriteLineEmphasized("ConsoleTools Demo - Progress spinner");

            HorizontalLine horizontalLine1 = new HorizontalLine
            {
                Character = '=',
                Margin    = "0 0 0 1"
            };

            horizontalLine1.Display();

            CustomConsole.WriteLine("Step 1: Select a template for the spinner.");
            CustomConsole.WriteLine("Step 2: The application will simulate some work and display the spinner until work is finish.");

            HorizontalLine horizontalLine2 = new HorizontalLine
            {
                Character = '-',
                Margin    = "0 0 0 1"
            };

            horizontalLine2.Display();
        }
Ejemplo n.º 4
0
        //Метод Init вызывается при инициализации (старте) индикатора.
        protected override void Init()
        {
            // получить значение начального Time Frame, на котором был запущен индикатор.
            _period = Timeframe;
            //  получить серию баров для торгового инструмента и торгового периода (Time Frame)
            //_barSeries = GetCustomSeries(Instrument.Id, Timeframe);

            _values = CreateSeries <double>();
            Print("Init");
            toolVerticalLine        = Tools.Create <VerticalLine>();
            toolVerticalLine.Color  = Color.Red;
            toolVerticalLine2       = Tools.Create <VerticalLine>();
            toolVerticalLine2.Color = Color.Blue;
            toolVerticalLine3       = Tools.Create <VerticalLine>();
            toolVerticalLine3.Color = Color.Aqua;
            toolVerticalLine4       = Tools.Create <VerticalLine>();
            toolVerticalLine4.Color = Color.DarkMagenta;

            toolHorizLine = Tools.Create <HorizontalLine>();

            //вывести в «Журнал событий» сообщение с периодом расчета индикатора.
            Print("TotalPeriod: {0}", TotalPeriod);
        }
Ejemplo n.º 5
0
        public override List <string> Render()
        {
            var builder = new List <string>();

            // Header
            //              ┌   ─   ┤   _   $NAME           _   ├   ─   ┐
            int minLength = 1 + 1 + 1 + 1 + Name.Length + 1 + 1 + 1 + 1;

            var targetWidth = Math.Max(minLength, ActualWidth);

            int    headerSpaces = Math.Max(0, ActualWidth - minLength);
            string header       = UpperLeftBorder + HorizontalLine + RightIntersection + " " + Name + " " + LeftIntersection + (new String(HorizontalLine.First(), headerSpaces)) + HorizontalLine + UpperRightBorder;

            builder.Add(header);

            // Content
            //
            var content = Content.Render();

            while (content.Count() < ActualHeight - 2)
            {
                content.Add("");
            }
            foreach (var line in content)
            {
                string l = VerticalLine + " " + line.PadRight(targetWidth - 4) + " " + VerticalLine;
                builder.Add(l);
            }

            // Footer
            //
            string footer = LowerLeftBorder + (new String(HorizontalLine.First(), targetWidth - 2)) + LowerRightBorder;

            builder.Add(footer);

            return(builder);
        }
        public override object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            int            numberOfLanes = (int)value + 1;
            HorizontalLine line          = (HorizontalLine)parameter;

            if (numberOfLanes == 1)
            {
                return(Visibility.Collapsed);
            }
            else if (numberOfLanes == 2)
            {
                if (line == HorizontalLine.Middle)
                {
                    return(Visibility.Visible);
                }
                return(Visibility.Hidden);
            }
            else if (numberOfLanes == 3)
            {
                if (line == HorizontalLine.InnerLeft || line == HorizontalLine.InnerRight)
                {
                    return(Visibility.Visible);
                }
                return(Visibility.Collapsed);
            }
            else
            {
                if (line == HorizontalLine.Middle ||
                    line == HorizontalLine.FirstOnLeftFromMiddle ||
                    line == HorizontalLine.FirstOnRightFromMiddle)
                {
                    return(Visibility.Visible);
                }
                return(Visibility.Collapsed);
            }
        }
Ejemplo n.º 7
0
        protected override void Init()
        {
            nu = false; nd = false; tu = false; td = false;
            InitFile();
            _ftoInd      = GetIndicator <FisherTransformOscillator>(Instrument.Id, Timeframe);
            _frInd       = GetIndicator <Fractals>(Instrument.Id, Timeframe);
            _frInd.Range = frac - 2;

            vl       = Tools.Create <VerticalLine>();
            vl.Width = 2;
            hl       = Tools.Create <HorizontalLine>();

            k   = 0;                     // Для першого входження -
            kf  = 0.090909;
            dlt = dl * Instrument.Point; // Отступ от стопа

            frU1 = 0.0; frU2 = 0.0; frU3 = 0.0;
            frD1 = 0.0; frD2 = 0.0; frD3 = 0.0;
            fsU1 = 0.0; fsU2 = 0.0; fsU3 = 0.0;
            fsD1 = 0.0; fsU2 = 0.0; fsU3 = 0.0;

            trueLogPath = PathToLogFile + "\\" + L1 + "_" + Instrument.Name.ToString() + ".LOG";
            trueBuyPath = PathToLogFile + "\\01_TORG.LOG";
        }
Ejemplo n.º 8
0
    void GenerateDrives()
    {
        for (float i = hour; i <= 22; i++)
        {
            var firstDrive = new HorizontalLine()
            {
                numberOfPlatform = GeneratePlatform(),
                numberOfTrack    = GenerateTracks(),
                hours            = i,
                minute           = Random.Range(0, 60)
            };

            var secondDrive = new HorizontalLine()
            {
                numberOfPlatform = GeneratePlatform(),
                numberOfTrack    = GenerateTracks(),
                hours            = i,
                minute           = Random.Range(0, 60)
            };

            TimeTable.Add(firstDrive);
            TimeTable.Add(secondDrive);
        }
    }
Ejemplo n.º 9
0
    void DrawExtraLine()
    {
        if (extralines == null || extralines.Count < 1)
        {
            return;
        }

        UnityEngine.GL.Begin(UnityEngine.GL.LINES);
        for (int i = 0; i < extralines.Count; i++)
        {
            HorizontalLine lineParam = extralines[i];
            Color          color     = lineParam.color;
            float          maxY      = lineParam.maxY;
            //if(lineParam.autoResizeY){
            lineParam.zoomY = graphHeightHalf / maxY;
            //}
            float zoomY = lineParam.zoomY;
            float y     = -lineParam.y * zoomY + graphHeightHalf;
            UnityEngine.GL.Color(color);
            UnityEngine.GL.Vertex(new Vector3(0, y, 0) + offset);
            UnityEngine.GL.Vertex(new Vector3(bufferNum * zoomX, y, 0) + offset);
        }
        UnityEngine.GL.End();
    }
Ejemplo n.º 10
0
        public Stage_1(int mapWidth, int mapHeight)
        {
            wallslist = new List <Figure>();

            //Borders
            Figure horizontalLineUp   = new HorizontalLine(0, mapWidth - 2, 0, '+');
            Figure horizontalLineDown = new HorizontalLine(0, mapWidth - 2, mapHeight - 1, '+');
            Figure leftLine           = new VerticalLine(0, mapHeight - 1, 0, '+');
            Figure rightLine          = new VerticalLine(0, mapHeight - 1, mapWidth - 2, '+');

            //Barriers
            Figure wall1 = new VerticalLine(0, 6, 50, '+');
            Figure wall2 = new VerticalLine(mapHeight - 8, mapHeight - 2, 90, '+');
            Figure wall3 = new VerticalLine(mapHeight - 10, mapHeight - 2, 30, '+');

            wallslist.Add(horizontalLineUp);
            wallslist.Add(horizontalLineDown);
            wallslist.Add(leftLine);
            wallslist.Add(rightLine);

            wallslist.Add(wall1);
            wallslist.Add(wall2);
            wallslist.Add(wall3);
        }
Ejemplo n.º 11
0
        protected override void AddChildElements()
        {
            AltGroupBox adjustmentControlsGroupBox = new AltGroupBox(new TextWidget("Tuning Adjustment".Localize(), pointSize: 18, textColor: ActiveTheme.Instance.SecondaryAccentColor));

            adjustmentControlsGroupBox.Margin      = new BorderDouble(0);
            adjustmentControlsGroupBox.BorderColor = ActiveTheme.Instance.PrimaryTextColor;
            adjustmentControlsGroupBox.HAnchor     = Agg.UI.HAnchor.ParentLeftRight;

            {
                FlowLayoutWidget tuningRatiosLayout = new FlowLayoutWidget(FlowDirection.TopToBottom);
                tuningRatiosLayout.Margin  = new BorderDouble(0, 0, 0, 0) * TextWidget.GlobalPointSizeScaleRatio;
                tuningRatiosLayout.HAnchor = HAnchor.ParentLeftRight;
                tuningRatiosLayout.Padding = new BorderDouble(3, 0, 3, 0) * TextWidget.GlobalPointSizeScaleRatio;

                double sliderWidth      = 300;
                double sliderThumbWidth = 10;
                if (ActiveTheme.Instance.DisplayMode == ActiveTheme.ApplicationDisplayType.Touchscreen)
                {
                    sliderWidth      = 280;
                    sliderThumbWidth = 20;
                }

                TextWidget subheader = new TextWidget("Fine-tune adjustment while actively printing", pointSize: 8, textColor: ActiveTheme.Instance.PrimaryTextColor);
                subheader.Margin = new BorderDouble(bottom: 6);
                tuningRatiosLayout.AddChild(subheader);
                TextWidget feedRateDescription;
                {
                    FlowLayoutWidget feedRateLeftToRight;
                    {
                        feedRateValue       = new NumberEdit(0, allowDecimals: true, minValue: minFeedRateRatio, maxValue: maxFeedRateRatio, pixelWidth: 40 * TextWidget.GlobalPointSizeScaleRatio);
                        feedRateValue.Value = ((int)(PrinterConnectionAndCommunication.Instance.FeedRateRatio * 100 + .5)) / 100.0;

                        feedRateLeftToRight         = new FlowLayoutWidget();
                        feedRateLeftToRight.HAnchor = HAnchor.ParentLeftRight;

                        feedRateDescription             = new TextWidget(LocalizedString.Get("Speed Multiplier"));
                        feedRateDescription.MinimumSize = new Vector2(140, 0) * TextWidget.GlobalPointSizeScaleRatio;
                        feedRateDescription.TextColor   = ActiveTheme.Instance.PrimaryTextColor;
                        feedRateDescription.VAnchor     = VAnchor.ParentCenter;
                        feedRateLeftToRight.AddChild(feedRateDescription);
                        feedRateRatioSlider                      = new SolidSlider(new Vector2(), sliderThumbWidth, minFeedRateRatio, maxFeedRateRatio);
                        feedRateRatioSlider.Margin               = new BorderDouble(5, 0);
                        feedRateRatioSlider.Value                = PrinterConnectionAndCommunication.Instance.FeedRateRatio;
                        feedRateRatioSlider.TotalWidthInPixels   = sliderWidth;
                        feedRateRatioSlider.View.BackgroundColor = new RGBA_Bytes();
                        feedRateRatioSlider.ValueChanged        += (sender, e) =>
                        {
                            PrinterConnectionAndCommunication.Instance.FeedRateRatio = feedRateRatioSlider.Value;
                        };
                        PrinterConnectionAndCommunication.Instance.FeedRateRatioChanged.RegisterEvent(FeedRateRatioChanged_Event, ref unregisterEvents);
                        feedRateValue.EditComplete += (sender, e) =>
                        {
                            feedRateRatioSlider.Value = feedRateValue.Value;
                        };
                        feedRateLeftToRight.AddChild(feedRateRatioSlider);
                        tuningRatiosLayout.AddChild(feedRateLeftToRight);

                        feedRateLeftToRight.AddChild(feedRateValue);
                        feedRateValue.Margin  = new BorderDouble(0, 0, 5, 0);
                        feedRateValue.VAnchor = VAnchor.ParentCenter;
                        textImageButtonFactory.FixedHeight       = (int)feedRateValue.Height + 1;
                        textImageButtonFactory.borderWidth       = 1;
                        textImageButtonFactory.normalBorderColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryTextColor, 200);
                        textImageButtonFactory.hoverBorderColor  = new RGBA_Bytes(ActiveTheme.Instance.PrimaryTextColor, 200);

                        Button setFeedRateButton = textImageButtonFactory.Generate(LocalizedString.Get("Set"));
                        setFeedRateButton.VAnchor = VAnchor.ParentCenter;

                        feedRateLeftToRight.AddChild(setFeedRateButton);
                    }

                    TextWidget extrusionDescription;
                    {
                        extrusionValue       = new NumberEdit(0, allowDecimals: true, minValue: minExtrutionRatio, maxValue: maxExtrusionRatio, pixelWidth: 40 * TextWidget.GlobalPointSizeScaleRatio);
                        extrusionValue.Value = ((int)(PrinterConnectionAndCommunication.Instance.ExtrusionRatio * 100 + .5)) / 100.0;

                        FlowLayoutWidget leftToRight = new FlowLayoutWidget();
                        leftToRight.HAnchor = HAnchor.ParentLeftRight;
                        leftToRight.Margin  = new BorderDouble(top: 10) * TextWidget.GlobalPointSizeScaleRatio;

                        extrusionDescription             = new TextWidget(LocalizedString.Get("Extrusion Multiplier"));
                        extrusionDescription.MinimumSize = new Vector2(140, 0) * TextWidget.GlobalPointSizeScaleRatio;
                        extrusionDescription.TextColor   = ActiveTheme.Instance.PrimaryTextColor;
                        extrusionDescription.VAnchor     = VAnchor.ParentCenter;
                        leftToRight.AddChild(extrusionDescription);
                        extrusionRatioSlider = new SolidSlider(new Vector2(), sliderThumbWidth, minExtrutionRatio, maxExtrusionRatio, Orientation.Horizontal);
                        extrusionRatioSlider.TotalWidthInPixels = sliderWidth;
                        extrusionRatioSlider.Margin             = new BorderDouble(5, 0);
                        extrusionRatioSlider.Value = PrinterConnectionAndCommunication.Instance.ExtrusionRatio;
                        extrusionRatioSlider.View.BackgroundColor = new RGBA_Bytes();
                        extrusionRatioSlider.ValueChanged        += (sender, e) =>
                        {
                            PrinterConnectionAndCommunication.Instance.ExtrusionRatio = extrusionRatioSlider.Value;
                        };
                        PrinterConnectionAndCommunication.Instance.ExtrusionRatioChanged.RegisterEvent(ExtrusionRatioChanged_Event, ref unregisterEvents);
                        extrusionValue.EditComplete += (sender, e) =>
                        {
                            extrusionRatioSlider.Value = extrusionValue.Value;
                        };
                        leftToRight.AddChild(extrusionRatioSlider);
                        tuningRatiosLayout.AddChild(leftToRight);
                        leftToRight.AddChild(extrusionValue);
                        extrusionValue.Margin              = new BorderDouble(0, 0, 5, 0);
                        extrusionValue.VAnchor             = VAnchor.ParentCenter;
                        textImageButtonFactory.FixedHeight = (int)extrusionValue.Height + 1;
                        Button setExtrusionButton = textImageButtonFactory.Generate(LocalizedString.Get("Set"));
                        setExtrusionButton.VAnchor = VAnchor.ParentCenter;
                        leftToRight.AddChild(setExtrusionButton);
                    }
                    feedRateLeftToRight.VAnchor = VAnchor.FitToChildren;
                }

                adjustmentControlsGroupBox.AddChild(tuningRatiosLayout);

                if (false)
                {
                    HorizontalLine line = new HorizontalLine();
                    line.Margin = new BorderDouble(0, 10);
                    tuningRatiosLayout.AddChild(line);
                    TextWidget subheader2 = new TextWidget("Fine-tune z-height, while actively printing", pointSize: 8, textColor: ActiveTheme.Instance.PrimaryTextColor);
                    subheader2.Margin = new BorderDouble(bottom: 6);
                    tuningRatiosLayout.AddChild(subheader2);

                    ImageBuffer togetherBig;
                    ImageBuffer appartBig;

                    CreateButtonImages(out togetherBig, out appartBig);

                    textImageButtonFactory.FixedHeight = 0;
                    Button togetherALot = textImageButtonFactory.GenerateFromImages("", togetherBig);
                    Button appartALot   = textImageButtonFactory.GenerateFromImages("", appartBig);

                    FlowLayoutWidget leftToRigth = new FlowLayoutWidget();
                    leftToRigth.AddChild(togetherALot);
                    leftToRigth.AddChild(appartALot);

                    tuningRatiosLayout.AddChild(leftToRigth);
                }
            }

            this.AddChild(adjustmentControlsGroupBox);
        }
Ejemplo n.º 12
0
        private static void HandleMenuBeforeDisplay(object sender, EventArgs args)
        {
            HorizontalLine horizontalLine = new HorizontalLine();

            horizontalLine.Display();
        }
Ejemplo n.º 13
0
        private void AddChildElements()
        {
            GuiWidget mainContainer = new GuiWidget();

            mainContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
            mainContainer.VAnchor = VAnchor.ParentBottomTop;

            TextInfo textInfo = new CultureInfo("en-US", false).TextInfo;
            {
                GuiWidget indicator = new GuiWidget();
                indicator.VAnchor = Agg.UI.VAnchor.ParentBottomTop;
                indicator.Width   = 15;
                if (printTask.PrintComplete)
                {
                    indicator.BackgroundColor = new RGBA_Bytes(38, 147, 51, 180);
                }
                else
                {
                    indicator.BackgroundColor = new RGBA_Bytes(252, 209, 22, 180);
                }

                FlowLayoutWidget middleColumn = new FlowLayoutWidget(FlowDirection.TopToBottom);
                middleColumn.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
                middleColumn.Padding = new BorderDouble(6, 3);
                {
                    FlowLayoutWidget labelContainer = new FlowLayoutWidget();
                    labelContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight;

                    string labelName = textInfo.ToTitleCase(printTask.PrintName);
                    labelName           = labelName.Replace('_', ' ');
                    partLabel           = new TextWidget(labelName, pointSize: 15 * pointSizeFactor);
                    partLabel.TextColor = WidgetTextColor;

                    labelContainer.AddChild(partLabel);

                    middleColumn.AddChild(labelContainer);
                }

                RGBA_Bytes timeTextColor = new RGBA_Bytes(34, 34, 34);

                FlowLayoutWidget buttonContainer = new FlowLayoutWidget();
                buttonContainer.Margin  = new BorderDouble(0);
                buttonContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
                {
                    TextWidget statusIndicator = new TextWidget("Status: Completed".Localize(), pointSize: 8 * pointSizeFactor);
                    statusIndicator.Margin = new BorderDouble(right: 3);
                    //buttonContainer.AddChild(statusIndicator);

                    string     printTimeLabel     = "Time".Localize().ToUpper();
                    string     printTimeLabelFull = string.Format("{0}: ", printTimeLabel);
                    TextWidget timeLabel          = new TextWidget(printTimeLabelFull, pointSize: 8 * pointSizeFactor);
                    timeLabel.TextColor = timeTextColor;

                    TextWidget timeIndicator;
                    int        minutes = printTask.PrintTimeMinutes;
                    if (minutes < 0)
                    {
                        timeIndicator = new TextWidget("Unknown".Localize());
                    }
                    else if (minutes > 60)
                    {
                        timeIndicator = new TextWidget("{0}hrs {1}min".FormatWith(printTask.PrintTimeMinutes / 60, printTask.PrintTimeMinutes % 60), pointSize: 12 * pointSizeFactor);
                    }
                    else
                    {
                        timeIndicator = new TextWidget(string.Format("{0}min", printTask.PrintTimeMinutes), pointSize: 12 * pointSizeFactor);
                    }

                    timeIndicator.Margin    = new BorderDouble(right: 6);
                    timeIndicator.TextColor = timeTextColor;

                    buttonContainer.AddChild(timeLabel);
                    buttonContainer.AddChild(timeIndicator);
                    buttonContainer.AddChild(new HorizontalSpacer());
                    middleColumn.AddChild(buttonContainer);
                }

                GuiWidget primaryContainer = new GuiWidget();
                primaryContainer.HAnchor = HAnchor.ParentLeftRight;
                primaryContainer.VAnchor = VAnchor.ParentBottomTop;

                FlowLayoutWidget primaryFlow = new FlowLayoutWidget(FlowDirection.LeftToRight);
                primaryFlow.HAnchor = HAnchor.ParentLeftRight;
                primaryFlow.VAnchor = VAnchor.ParentBottomTop;

                primaryFlow.AddChild(indicator);
                primaryFlow.AddChild(middleColumn);

                primaryContainer.AddChild(primaryFlow);

                rightButtonOverlay         = new SlideWidget();
                rightButtonOverlay.VAnchor = VAnchor.ParentBottomTop;
                rightButtonOverlay.HAnchor = Agg.UI.HAnchor.ParentRight;
                rightButtonOverlay.Width   = rightOverlayWidth;
                rightButtonOverlay.Visible = false;

                FlowLayoutWidget rightMiddleColumnContainer = new FlowLayoutWidget(FlowDirection.LeftToRight);
                rightMiddleColumnContainer.VAnchor = VAnchor.ParentBottomTop;
                {
                    TextWidget viewLabel = new TextWidget("View".Localize());
                    viewLabel.TextColor = RGBA_Bytes.White;
                    viewLabel.VAnchor   = VAnchor.ParentCenter;
                    viewLabel.HAnchor   = HAnchor.ParentCenter;

                    FatFlatClickWidget viewButton = new FatFlatClickWidget(viewLabel);
                    viewButton.VAnchor         = VAnchor.ParentBottomTop;
                    viewButton.BackgroundColor = ActiveTheme.Instance.SecondaryAccentColor;
                    viewButton.Width           = actionButtonSize;
                    viewButton.Click          += ViewButton_Click;
                    rightMiddleColumnContainer.AddChild(viewButton);

                    TextWidget printLabel = new TextWidget("Print".Localize());
                    printLabel.TextColor = RGBA_Bytes.White;
                    printLabel.VAnchor   = VAnchor.ParentCenter;
                    printLabel.HAnchor   = HAnchor.ParentCenter;

                    FatFlatClickWidget printButton = new FatFlatClickWidget(printLabel);
                    printButton.VAnchor         = VAnchor.ParentBottomTop;
                    printButton.BackgroundColor = ActiveTheme.Instance.PrimaryAccentColor;
                    printButton.Width           = actionButtonSize;
                    printButton.Click          += (sender, e) =>
                    {
                        UiThread.RunOnIdle(() =>
                        {
                            if (!PrinterCommunication.PrinterConnectionAndCommunication.Instance.PrintIsActive)
                            {
                                QueueData.Instance.AddItem(new PrintItemWrapper(printTask.PrintItemId), 0);
                                QueueData.Instance.SelectedIndex = 0;
                                PrinterCommunication.PrinterConnectionAndCommunication.Instance.PrintActivePartIfPossible();
                            }
                            else
                            {
                                QueueData.Instance.AddItem(new PrintItemWrapper(printTask.PrintItemId));
                            }
                            rightButtonOverlay.SlideOut();
                        });
                    };
                    rightMiddleColumnContainer.AddChild(printButton);
                }
                rightButtonOverlay.AddChild(rightMiddleColumnContainer);

                if (showTimestamp)
                {
                    FlowLayoutWidget timestampColumn = new FlowLayoutWidget(FlowDirection.TopToBottom);
                    timestampColumn.VAnchor         = Agg.UI.VAnchor.ParentBottomTop;
                    timestampColumn.BackgroundColor = RGBA_Bytes.LightGray;
                    timestampColumn.Padding         = new BorderDouble(6, 0);

                    FlowLayoutWidget startTimeContainer = new FlowLayoutWidget();
                    startTimeContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
                    startTimeContainer.Padding = new BorderDouble(0, 3);

                    string     startLabelFull = "{0}:".FormatWith("Start".Localize().ToUpper());
                    TextWidget startLabel     = new TextWidget(startLabelFull, pointSize: 8 * pointSizeFactor);
                    startLabel.TextColor = timeTextColor;

                    string     startTimeString = printTask.PrintStart.ToString("MMM d yyyy h:mm ") + printTask.PrintStart.ToString("tt").ToLower();
                    TextWidget startDate       = new TextWidget(startTimeString, pointSize: 12 * pointSizeFactor);
                    startDate.TextColor = timeTextColor;

                    startTimeContainer.AddChild(startLabel);
                    startTimeContainer.AddChild(new HorizontalSpacer());
                    startTimeContainer.AddChild(startDate);

                    FlowLayoutWidget endTimeContainer = new FlowLayoutWidget();
                    endTimeContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
                    endTimeContainer.Padding = new BorderDouble(0, 3);

                    string     endLabelFull = "{0}:".FormatWith("End".Localize().ToUpper());
                    TextWidget endLabel     = new TextWidget(endLabelFull, pointSize: 8 * pointSizeFactor);
                    endLabel.TextColor = timeTextColor;

                    string endTimeString;
                    if (printTask.PrintEnd != DateTime.MinValue)
                    {
                        endTimeString = printTask.PrintEnd.ToString("MMM d yyyy h:mm ") + printTask.PrintEnd.ToString("tt").ToLower();
                    }
                    else
                    {
                        endTimeString = "Unknown".Localize();
                    }

                    TextWidget endDate = new TextWidget(endTimeString, pointSize: 12 * pointSizeFactor);
                    endDate.TextColor = timeTextColor;

                    endTimeContainer.AddChild(endLabel);
                    endTimeContainer.AddChild(new HorizontalSpacer());
                    endTimeContainer.AddChild(endDate);

                    HorizontalLine horizontalLine = new HorizontalLine();
                    horizontalLine.BackgroundColor = RGBA_Bytes.Gray;

                    timestampColumn.AddChild(endTimeContainer);
                    timestampColumn.AddChild(horizontalLine);
                    timestampColumn.AddChild(startTimeContainer);

                    timestampColumn.Width = rightOverlayWidth;

                    primaryFlow.AddChild(timestampColumn);
                }

                mainContainer.AddChild(primaryContainer);
                mainContainer.AddChild(rightButtonOverlay);

                this.AddChild(mainContainer);
            }
        }
Ejemplo n.º 14
0
 public void SetExtraLine(HorizontalLine extraLine)
 {
     extralines.Add(extraLine);
 }
Ejemplo n.º 15
0
        public PrintHistoryListItem(ListViewItem listViewItem, int thumbWidth, int thumbHeight, PrintTask printTask, bool showTimestamp, ThemeConfig theme)
            : base(listViewItem, thumbWidth, thumbHeight, theme)
        {
            this.printTask     = printTask;
            this.showTimestamp = showTimestamp;

            this.HAnchor         = Agg.UI.HAnchor.Stretch;
            this.Height          = 50;
            this.BackgroundColor = this.WidgetBackgroundColor;
            this.Padding         = new BorderDouble(0);
            this.Margin          = new BorderDouble(6, 0, 6, 6);

            var mainContainer = new GuiWidget();

            mainContainer.HAnchor = HAnchor.Stretch;
            mainContainer.VAnchor = VAnchor.Stretch;

            TextInfo textInfo = new CultureInfo("en-US", false).TextInfo;
            {
                GuiWidget indicator = new GuiWidget();
                indicator.VAnchor = Agg.UI.VAnchor.Stretch;
                indicator.Width   = 15;
                if (printTask.PrintComplete)
                {
                    indicator.BackgroundColor = new Color(38, 147, 51, 180);
                }
                else
                {
                    indicator.BackgroundColor = new Color(252, 209, 22, 180);
                }

                FlowLayoutWidget middleColumn = new FlowLayoutWidget(FlowDirection.TopToBottom);
                middleColumn.HAnchor = Agg.UI.HAnchor.Stretch;
                middleColumn.Padding = new BorderDouble(6, 3);
                {
                    FlowLayoutWidget labelContainer = new FlowLayoutWidget();
                    labelContainer.HAnchor = Agg.UI.HAnchor.Stretch;

                    string labelName = textInfo.ToTitleCase(printTask.PrintName);
                    labelName           = labelName.Replace('_', ' ');
                    partLabel           = new TextWidget(labelName, pointSize: 15 * pointSizeFactor);
                    partLabel.TextColor = WidgetTextColor;

                    labelContainer.AddChild(partLabel);

                    middleColumn.AddChild(labelContainer);
                }

                Color timeTextColor = new Color(34, 34, 34);

                FlowLayoutWidget buttonContainer = new FlowLayoutWidget();
                buttonContainer.Margin  = new BorderDouble(0);
                buttonContainer.HAnchor = Agg.UI.HAnchor.Stretch;
                {
                    var timeLabel = new TextWidget("Time".Localize().ToUpper() + ": ", pointSize: 8 * pointSizeFactor);
                    timeLabel.TextColor = timeTextColor;

                    TextWidget timeIndicator;
                    int        minutes = printTask.PrintTimeMinutes;
                    if (minutes < 0)
                    {
                        timeIndicator = new TextWidget("Unknown".Localize());
                    }
                    else if (minutes > 60)
                    {
                        timeIndicator = new TextWidget("{0}hrs {1}min".FormatWith(printTask.PrintTimeMinutes / 60, printTask.PrintTimeMinutes % 60), pointSize: 12 * pointSizeFactor);
                    }
                    else
                    {
                        timeIndicator = new TextWidget(string.Format("{0}min", printTask.PrintTimeMinutes), pointSize: 12 * pointSizeFactor);
                    }

                    if (printTask.PercentDone > 0)
                    {
                        timeIndicator.AutoExpandBoundsToText = true;
                        timeIndicator.Text += $" ({printTask.PercentDone:0.0}%)";

                        if (printTask.RecoveryCount > 0)
                        {
                            if (printTask.RecoveryCount == 1)
                            {
                                timeIndicator.Text += " - " + "recovered once".Localize();
                            }
                            else
                            {
                                timeIndicator.Text += " - " + "recovered {0} times".FormatWith(printTask.RecoveryCount);
                            }
                        }
                    }

                    timeIndicator.Margin    = new BorderDouble(right: 6);
                    timeIndicator.TextColor = timeTextColor;

                    buttonContainer.AddChild(timeLabel);
                    buttonContainer.AddChild(timeIndicator);
                    buttonContainer.AddChild(new HorizontalSpacer());
                    middleColumn.AddChild(buttonContainer);
                }

                GuiWidget primaryContainer = new GuiWidget();
                primaryContainer.HAnchor = HAnchor.Stretch;
                primaryContainer.VAnchor = VAnchor.Stretch;

                FlowLayoutWidget primaryFlow = new FlowLayoutWidget(FlowDirection.LeftToRight);
                primaryFlow.HAnchor = HAnchor.Stretch;
                primaryFlow.VAnchor = VAnchor.Stretch;

                primaryFlow.AddChild(indicator);
                primaryFlow.AddChild(middleColumn);

                primaryContainer.AddChild(primaryFlow);

                if (showTimestamp)
                {
                    FlowLayoutWidget timestampColumn = new FlowLayoutWidget(FlowDirection.TopToBottom);
                    timestampColumn.VAnchor         = Agg.UI.VAnchor.Stretch;
                    timestampColumn.BackgroundColor = Color.LightGray;
                    timestampColumn.Padding         = new BorderDouble(6, 0);

                    FlowLayoutWidget startTimeContainer = new FlowLayoutWidget();
                    startTimeContainer.HAnchor = Agg.UI.HAnchor.Stretch;
                    startTimeContainer.Padding = new BorderDouble(0, 3);

                    string     startLabelFull = "{0}:".FormatWith("Start".Localize().ToUpper());
                    TextWidget startLabel     = new TextWidget(startLabelFull, pointSize: 8 * pointSizeFactor);
                    startLabel.TextColor = timeTextColor;

                    string     startTimeString = printTask.PrintStart.ToString("MMM d yyyy h:mm ") + printTask.PrintStart.ToString("tt").ToLower();
                    TextWidget startDate       = new TextWidget(startTimeString, pointSize: 12 * pointSizeFactor);
                    startDate.TextColor = timeTextColor;

                    startTimeContainer.AddChild(startLabel);
                    startTimeContainer.AddChild(new HorizontalSpacer());
                    startTimeContainer.AddChild(startDate);

                    FlowLayoutWidget endTimeContainer = new FlowLayoutWidget();
                    endTimeContainer.HAnchor = Agg.UI.HAnchor.Stretch;
                    endTimeContainer.Padding = new BorderDouble(0, 3);

                    string     endLabelFull = "{0}:".FormatWith("End".Localize().ToUpper());
                    TextWidget endLabel     = new TextWidget(endLabelFull, pointSize: 8 * pointSizeFactor);
                    endLabel.TextColor = timeTextColor;

                    string endTimeString;
                    if (printTask.PrintEnd != DateTime.MinValue)
                    {
                        endTimeString = printTask.PrintEnd.ToString("MMM d yyyy h:mm ") + printTask.PrintEnd.ToString("tt").ToLower();
                    }
                    else
                    {
                        endTimeString = "Unknown".Localize();
                    }

                    TextWidget endDate = new TextWidget(endTimeString, pointSize: 12 * pointSizeFactor);
                    endDate.TextColor = timeTextColor;

                    endTimeContainer.AddChild(endLabel);
                    endTimeContainer.AddChild(new HorizontalSpacer());
                    endTimeContainer.AddChild(endDate);

                    HorizontalLine horizontalLine = new HorizontalLine();
                    horizontalLine.BackgroundColor = Color.Gray;

                    timestampColumn.AddChild(endTimeContainer);
                    timestampColumn.AddChild(horizontalLine);
                    timestampColumn.AddChild(startTimeContainer);

                    timestampColumn.HAnchor = HAnchor.Stretch;
                    timestampColumn.Padding = new BorderDouble(5, 0, 15, 0);

                    primaryFlow.AddChild(timestampColumn);
                }

                mainContainer.AddChild(primaryContainer);

                this.AddChild(mainContainer);
            }
        }
Ejemplo n.º 16
0
        protected override void NewBar()
        {
            // Значения Alligator около фрактала
            aGuba5    = _allInd.LipsSeries[Bars.Range.To - 5];
            aZub5     = _allInd.TeethSeries[Bars.Range.To - 5];
            aChelust5 = _allInd.JawsSeries[Bars.Range.To - 5];

            // Значене Alligator у цены
            aGuba    = _allInd.LipsSeries[Bars.Range.To];   //З
            aZub     = _allInd.TeethSeries[Bars.Range.To];  //К
            aChelust = _allInd.JawsSeries[Bars.Range.To];   //С

            DTime = Bars[Bars.Range.To - 5].Time;

            if (DTime.TimeOfDay.ToString() == "05:00:00")
            {
                Time_Start = true;
            }
            if (DTime.TimeOfDay.ToString() == "18:00:00")
            {
                Time_Start = false;
            }
            Print("Stop - {0}", (DTime.TimeOfDay.ToString() == "18:00:00"));

            // 1. Линии Alligator переплетены - Торгуем
            if (!((aZub > aChelust && aGuba > aZub) || (aZub > aGuba && aChelust > aZub)))
            {
                Torg = true;
            }

            // Данные индиктора Fractal - который первый после текущей цены
            // Запоминаем значени бара-фрактала(frUp) и время (frUp_Time)
            // Срабатывает - когда появился новый фрактал!
            if (_frInd.TopSeries[Bars.Range.To - 5] > 0)
            {
                frUp = Bars[Bars.Range.To - 5].High; frUpL = Bars[Bars.Range.To - 5].Low; frUp_Time = Bars[Bars.Range.To - 5].Time;
            }
            if (_frInd.BottomSeries[Bars.Range.To - 5] > 0)
            {
                frDown = Bars[Bars.Range.To - 5].Low; frDownH = Bars[Bars.Range.To - 5].High; frDown_Time = Bars[Bars.Range.To - 5].Time;
            }

            // Fractal ВЫШЕ Alligatora И свеча не касается Alligator-
            // низ Бар-Фрактала выше Alligator  - Назначаем рабочим (fr_all_Up) для Buy
            if (frUp > 0 && frUpL > aGuba5 && frUpL > aChelust5 && frUpL > aZub5 && _frInd.TopSeries[Bars.Range.To - 5] > 0)
            {
                fr_all_Up = frUp; fr_all_Up_Time = frUp_Time; fBuy = true;

                // Рисуем горизонтальную линию сигнала	Buy
                Tools.Remove(hline);
                Print("Сигнал на Buy - {0} -- {1}", frUp_Time, frUp);
                hline       = Tools.Create <HorizontalLine>();
                hline.Price = frUp;
                hline.Text  = "Buy - " + frUp_Time;
            }

            // Если есть фрактал, есть сигнал на продажу и разрешение на торг
            //НО! свеча нового фрактала пересекает линию Аллигатора - отменяем позицию.
            //	if ( _frInd.TopSeries[Bars.Range.To-5]>0)
            //		Print("Пересечение  Алигатора фракталом {0} {1}",( frUpL<aGuba5 || frUpL<aChelust5 || frUpL<aZub5 ),Bars[Bars.Range.To-5].Time);

            if (frUp > 0 && Torg && fBuy && (frUpL < aGuba5 || frUpL < aChelust5 || frUpL < aZub5) && _frInd.TopSeries[Bars.Range.To - 5] > 0)
            {
                fBuy = false; Print("Отмена - Buy {0} - на Баре {1}", fr_all_Up_Time, Bars[Bars.Range.To - 1].Time);
            }

            // Fractal НИЖЕ Alligatora И свеча не касается Alligator -
            // верх Бар-Фрактала выше Alligator  - Назначаем рабочим (fr_all_Down) для Sell
            if (frDown > 0 && frDownH < aGuba5 && frDownH < aChelust5 && frDownH < aZub5 && _frInd.BottomSeries[Bars.Range.To - 5] > 0)
            {
                fr_all_Down = frDown;  fr_all_Down_Time = frDown_Time; fSell = true;

                // Рисуем горизонтальную линию сигнала	Sell
                Tools.Remove(lline);
                Print("Сигнал на Sell - {0} -- {1}", frDown_Time, frDown);
                lline       = Tools.Create <HorizontalLine>();
                lline.Price = fr_all_Down;
                lline.Text  = "Sell = " + fr_all_Down_Time;
            }

            // Если есть фрактал, есть сигнал на продажу и разрешение на торг
            //НО! свеча нового фрактала пересекает линию Аллигатора - отменяем позицию.
            //if (_frInd.TopSeries[Bars.Range.To-5]>0) Print("DOWN - {0} {1} {2} - {3}",(Torg,fSell frDownH>aGuba5 || frDownH>aChelust5 || frDownH>aZub5 ), Bars[Bars.Range.To-5].Time);

            if (frDown > 0 && Torg && fSell && (frDownH > aGuba5 || frDownH > aChelust5 || frDownH > aZub5) && _frInd.BottomSeries[Bars.Range.To - 5] > 0)
            {
                fSell = false; Print("Отмена -  Sell {0} - на Баре -{1}", fr_all_Down_Time, Bars[Bars.Range.To - 1].Time);
            }

            // Если есть сигнал на покупку(fBuy) и не открыт дугой ордер Buy
            // и текущий бар пересек HIGH РАБОЧЕГО Fractala  - Открываем ордер Buy
            if (Time_Start && Torg && fBuy && !pBuy && fr_all_Up < Bars[Bars.Range.To - 1].High && _positionGuid == Guid.Empty)
            {
                Buy(); pBuy = true; fBuy = false; Torg = false;
            }

            // Если есть сигнал на продажу(fBuy) и не открыт дугой ордер Sell
            // и текущий бар пересек LOW РАБОЧЕГО Fractala  - Открываем ордер Sell
            if (Time_Start && Torg && fSell && !pSell && fr_all_Down > Bars[Bars.Range.To - 1].Low && _positionGuid == Guid.Empty)
            {
                Sell(); pSell = true;  fSell = false; Torg = false;
            }

            // Закрываем ордер на покупку когда свеча каснется Зубов Alligator
            if (pBuy && Bars[Bars.Range.To - 1].Low < aZub && _positionGuid != Guid.Empty)
            {
                ClosePosition();  pBuy = false; Torg = false;
            }

            // Закрываем ордер на продажу когда свеча каснется Зубов
            if (pSell && Bars[Bars.Range.To - 1].High > aZub && _positionGuid != Guid.Empty)
            {
                ClosePosition();  pSell = false; Torg = false;
            }
        }
Ejemplo n.º 17
0
        public override void DrawOrMove(ChartPoint previousDrawn, ChartPoint current, int index, ChartCore chart)
        {
            if (IsNew)
            {
                VerticalLine.X1 = current.ChartLocation.X;
                VerticalLine.X2 = current.ChartLocation.X;
                VerticalLine.Y1 = chart.DrawMargin.Height;
                VerticalLine.Y2 = chart.DrawMargin.Height;

                HorizontalLine.X1 = current.ChartLocation.X - DeltaX;
                HorizontalLine.X2 = current.ChartLocation.X;
                HorizontalLine.Y1 = chart.DrawMargin.Height;
                HorizontalLine.Y2 = chart.DrawMargin.Height;

                if (Shape != null)
                {
                    Canvas.SetLeft(Shape, current.ChartLocation.X - Shape.Width / 2);
                    Canvas.SetTop(Shape, chart.DrawMargin.Height);
                }
            }

            if (DataLabel != null && double.IsNaN(Canvas.GetLeft(DataLabel)))
            {
                Canvas.SetTop(DataLabel, chart.DrawMargin.Height);
                Canvas.SetLeft(DataLabel, current.ChartLocation.X);
            }

            if (HoverShape != null)
            {
                HoverShape.Width  = Shape != null ? (Shape.Width > 5 ? Shape.Width : 5) : 5;
                HoverShape.Height = Shape != null ? (Shape.Height > 5 ? Shape.Height : 5) : 5;
                Canvas.SetLeft(HoverShape, current.ChartLocation.X - HoverShape.Width / 2);
                Canvas.SetTop(HoverShape, current.ChartLocation.Y - HoverShape.Height / 2);
            }

            if (chart.View.DisableAnimations)
            {
                VerticalLine.X1 = current.ChartLocation.X;
                VerticalLine.X2 = current.ChartLocation.X;
                VerticalLine.Y1 = current.ChartLocation.Y;
                VerticalLine.Y2 = current.ChartLocation.Y - DeltaY;

                HorizontalLine.X1 = current.ChartLocation.X - DeltaX;
                HorizontalLine.X2 = current.ChartLocation.X;
                HorizontalLine.Y1 = current.ChartLocation.Y - DeltaY;
                HorizontalLine.Y2 = current.ChartLocation.Y - DeltaY;

                if (Shape != null)
                {
                    Canvas.SetLeft(Shape, current.ChartLocation.X - Shape.Width / 2);
                    Canvas.SetTop(Shape, current.ChartLocation.Y - Shape.Height / 2);
                }

                if (DataLabel != null)
                {
                    DataLabel.UpdateLayout();
                    var xl = CorrectXLabel(current.ChartLocation.X - DataLabel.ActualWidth * .5, chart);
                    var yl = CorrectYLabel(current.ChartLocation.Y - DataLabel.ActualHeight * .5, chart);
                    Canvas.SetLeft(DataLabel, xl);
                    Canvas.SetTop(DataLabel, yl);
                }

                return;
            }

            var animSpeed = chart.View.AnimationsSpeed;

            VerticalLine.BeginDoubleAnimation(nameof(Line.X1), current.ChartLocation.X, animSpeed);
            VerticalLine.BeginDoubleAnimation(nameof(Line.X2), current.ChartLocation.X, animSpeed);
            VerticalLine.BeginDoubleAnimation(nameof(Line.Y1), current.ChartLocation.Y, animSpeed);
            VerticalLine.BeginDoubleAnimation(nameof(Line.Y2), current.ChartLocation.Y - DeltaY, animSpeed);

            HorizontalLine.BeginDoubleAnimation(nameof(Line.X1), current.ChartLocation.X - DeltaX, animSpeed);
            HorizontalLine.BeginDoubleAnimation(nameof(Line.X2), current.ChartLocation.X, animSpeed);
            HorizontalLine.BeginDoubleAnimation(nameof(Line.Y1), current.ChartLocation.Y - DeltaY, animSpeed);
            HorizontalLine.BeginDoubleAnimation(nameof(Line.Y2), current.ChartLocation.Y - DeltaY, animSpeed);

            Shape?.CreateCanvasStoryBoardAndBegin(current.ChartLocation.X - Shape.Width / 2,
                                                  current.ChartLocation.Y - Shape.Height / 2, animSpeed);

            if (DataLabel == null)
            {
                return;
            }

            {
                DataLabel.UpdateLayout();
                var xl = CorrectXLabel(current.ChartLocation.X - DataLabel.ActualWidth * .5, chart);
                var yl = CorrectYLabel(current.ChartLocation.Y - DataLabel.ActualHeight * .5, chart);
                Canvas.SetLeft(DataLabel, xl);
                Canvas.SetTop(DataLabel, yl);
            }
        }
Ejemplo n.º 18
0
    void GenerateStage()
    {
        float xLength   = maxXPos - minXPos;
        float xInterval = 2;
        float yLength   = maxYPos - minYPos;
        float yInterval = yLength / (HorizontalLinesNum + 1);

        //▼縦線の生成
        for (int i = 0; i < underBoxTypes.Length; i++)
        {
            Instantiate(VerticalLine, new Vector3(minXPos + (xInterval * i), 0.5f, 0), Quaternion.identity);
        }

        //▼横線の生成
        HorizontalLine[,] amidaLines = new HorizontalLine[underBoxTypes.Length - 1, HorizontalLinesNum];

        for (int i = 0; i < underBoxTypes.Length - 1; i++)
        {
            for (int j = 0; j < HorizontalLinesNum; j++)
            {
                amidaLines[i, j] = Instantiate(HorizontalLine,
                                               new Vector3(minXPos + (xInterval * i) + 1, maxYPos - ((yInterval * j) + (i % 2 * yInterval / 2)) - 1, 0),
                                               Quaternion.identity).GetComponent <HorizontalLine>();

                amidaLines[i, j].minusRemainLinesDelegate = () => { gameManager.RemainLines--; };
                amidaLines[i, j].plusRemainLinesDelegate  = () => { gameManager.RemainLines++; };
                amidaLines[i, j].isDrawLineDelegate       = () => { return(gameManager.RemainLines > 0); };
            }
        }

        lineCursol.AmidaLines  = amidaLines;
        gameManager.AmidaLines = amidaLines;

        //▼油の生成
        List <Oil>   oils    = new List <Oil>();
        List <Trash> trashes = new List <Trash>();

        for (int i = 0; i < underBoxTypes.Length; i++)
        {
            switch (underBoxTypes[i])
            {
            case UnderBoxType.highTempOil:
                oils.Add(Instantiate(HighOil, new Vector3(minXPos + (xInterval * i), minYPos - 1, 0), Quaternion.identity).GetComponent <Oil>());
                break;

            case UnderBoxType.moderateTempOil:
                oils.Add(Instantiate(ModerateOil, new Vector3(minXPos + (xInterval * i), minYPos - 1, 0), Quaternion.identity).GetComponent <Oil>());
                break;

            case UnderBoxType.lowTempOil:
                oils.Add(Instantiate(LowOil, new Vector3(minXPos + (xInterval * i), minYPos - 1, 0), Quaternion.identity).GetComponent <Oil>());
                break;

            case UnderBoxType.trash:
                trashes.Add(Instantiate(TrashBox, new Vector3(minXPos + (xInterval * i), minYPos - 1, 0), Quaternion.identity).GetComponent <Trash>());
                break;
            }
        }

        gameManager.Oils    = oils;
        gameManager.Trashes = trashes;

        //▼食材生成場所の生成
        //ここGameObjectよりVector3で渡したほうが良い
        GameObject[] foodGeneratePlaces = new GameObject[underBoxTypes.Length];
        for (int i = 0; i < underBoxTypes.Length; i++)
        {
            foodGeneratePlaces[i] = Instantiate(new GameObject("foodGeneratePlace"), new Vector3(minXPos + (xInterval * i), maxYPos, 0), Quaternion.identity);
        }

        foodGenerater.GeneratePlaces = foodGeneratePlaces;

        //▼アイテム生成場所の生成
        //ここGameObjectよりVector3で渡したほうが良い
        GameObject[,] itemGeneraterPlaces = new GameObject[underBoxTypes.Length, HorizontalLinesNum - 2];
        for (int i = 0; i < underBoxTypes.Length; i++)
        {
            for (int j = 0; j < HorizontalLinesNum - 2; j++)
            {
                itemGeneraterPlaces[i, j] = Instantiate(new GameObject("itemGeneraterPlace"), new Vector3(minXPos + (xInterval * i), maxYPos - (yInterval * j) - 1, 0), Quaternion.identity);
            }
        }

        itemGenerater.GeneratePlaces = itemGeneraterPlaces;
    }
Ejemplo n.º 19
0
        protected override void DoExecute()
        {
            HorizontalLine horizontalLine = new HorizontalLine();

            horizontalLine.Display();
        }
Ejemplo n.º 20
0
    void DrawHLine()
    {
        HorizontalLine hLine = AmidaLines[position.X, position.Y];

        hLine.SetOnObjActivation(!hLine.IsOnObjActive());
    }
Ejemplo n.º 21
0
    void SpawnHorizontalLine()
    {
        HorizontalLine newHorizontalLine = Instantiate(_horizontalLinePrefab, new Vector3(transform.position.x, _ySpawnPosition, 0), transform.rotation);

        newHorizontalLine.Init(_horizontalLineAcceleration, _horizontalLineBeginningSpeed);
    }
    void OnGUI()
    {
        if (SceneView.lastActiveSceneView == null)
        {
            return;
        }

        // Camera data transfer controls
        EditorGUILayout.BeginHorizontal();
        {
            GUI.enabled = false;

            EditorGUILayout.ObjectField(SceneView.lastActiveSceneView.camera, typeof(Camera), true, GUILayout.MaxWidth(150));

            GUI.enabled = (targetCam != null) && !syncCam;
            if (GUILayout.Button("<-"))
            {
                controledProperties.Copy(targetCam);
                SetSceneCamTransformData();
            }

            GUI.enabled = targetCam != null;
            syncCam     = EditorGUILayout.Toggle(syncCam, "IN LockButton", GUILayout.MaxWidth(15));

            GUI.enabled = (targetCam != null) && !syncCam;
            if (GUILayout.Button("->"))
            {
                controledProperties.Paste(targetCam, _syncFOV);
            }

            GUI.enabled = true;
            EditorGUIUtility.labelWidth = 80;
            targetCam = (Camera)EditorGUILayout.ObjectField(targetCam, typeof(Camera), true, GUILayout.MaxWidth(150));
            EditorGUIUtility.labelWidth = -1;
        }
        EditorGUILayout.EndHorizontal();

        if (GUI.changed)
        {
            SceneView.lastActiveSceneView.Repaint();
        }

        // Scene camera Inspector
        HorizontalLine.Draw();
        EditorGUILayout.LabelField(EditorGUIUtility.ObjectContent(SceneView.lastActiveSceneView.camera, typeof(Camera)));

        EditorGUI.indentLevel = EditorGUI.indentLevel + 1;
        if (showSceneCamData) //TODO foldout arrow
        {
            GUI.changed = false;

            EditorGUIUtility.wideMode = true;

            DrawTransformData();

            GUILayout.BeginHorizontal();
            controledProperties.fov = EditorGUILayout.Slider(new GUIContent("Field Of View"), controledProperties.fov, 0.1f, 200f, GUILayout.ExpandWidth(true));

            if (GUILayout.Button("Reset", GUILayout.MaxWidth(50f)))
            {
                resetFovOnce = true;
            }

            _syncFOV = EditorGUILayout.Toggle("Sync FOV", _syncFOV);
            GUILayout.EndHorizontal();

            if (GUI.changed)
            {
                SetSceneCamTransformData();
                SceneView.lastActiveSceneView.Repaint();
            }
        }
    }
        public override void Initialize()
        {
            previewTile = new Tile(1);
            previewTile.Initialize("GroundTile1");
            ResourceManager.Instance.Fonts.TryGetValue("FontMedium", out font);

            previewEntity = new Slime();
            previewEntity.Initialize("Slime");

            UIManager = new UserInterface(ResourceManager.Instance.Content);
            UIManager.Initialize();
            UserInterface.SCALE = 0.7f;

            Panel menuBar = new Panel(size: new Vector2(1680, 70), skin: PanelSkin.Simple, anchor: Anchor.TopCenter, offset: new Vector2(0, 0));

            menuBar.OnMouseEnter = (GeonBit.UI.Entities.Entity entity) =>
            {
                overUI = true;
            };
            menuBar.OnMouseLeave = (GeonBit.UI.Entities.Entity entity) =>
            {
                overUI = false;
            };
            UIManager.AddEntity(menuBar);

            Button file = new Button("File", ButtonSkin.Default, Anchor.CenterLeft, new Vector2(300, 60), null);

            menuBar.AddChild(file);

            Panel filePanel = new Panel(new Vector2(300, 305), PanelSkin.Simple, Anchor.TopLeft, new Vector2(0, 35));

            filePanel.Visible      = false;
            filePanel.OnMouseEnter = (GeonBit.UI.Entities.Entity entity) =>
            {
                overUI = true;
            };
            filePanel.OnMouseLeave = (GeonBit.UI.Entities.Entity entity) =>
            {
                overUI = false;
            };
            menuBar.AddChild(filePanel);

            file.OnClick = (GeonBit.UI.Entities.Entity btn) =>
            {
                TogglePanel(filePanel);
            };

            Button newMap = new Button("New Map", ButtonSkin.Default, Anchor.TopCenter, new Vector2(290, 60), null);

            newMap.OnClick = (GeonBit.UI.Entities.Entity btn) =>
            {
                NewMap();
                TogglePanel(filePanel);
            };
            filePanel.AddChild(newMap);

            Button loadMap = new Button("Load Map", ButtonSkin.Default, Anchor.TopCenter, new Vector2(290, 60), new Vector2(0, 65));

            loadMap.OnClick = (GeonBit.UI.Entities.Entity btn) =>
            {
                LoadMap();
                TogglePanel(filePanel);
            };
            filePanel.AddChild(loadMap);

            Button saveMap = new Button("Save Map", ButtonSkin.Default, Anchor.TopCenter, new Vector2(290, 60), new Vector2(0, 130));

            saveMap.OnClick = (GeonBit.UI.Entities.Entity btn) =>
            {
                SaveMap();
                TogglePanel(filePanel);
            };
            filePanel.AddChild(saveMap);

            HorizontalLine filePanleLine = new HorizontalLine(Anchor.TopCenter, new Vector2(0, 200));

            filePanel.AddChild(filePanleLine);

            Button exitEditor = new Button("Exit Editor", ButtonSkin.Default, Anchor.TopCenter, new Vector2(290, 60), new Vector2(0, 210));

            exitEditor.OnClick = (GeonBit.UI.Entities.Entity btn) =>
            {
                ExitMapEditor();
            };
            filePanel.AddChild(exitEditor);

            Button tileMode = new Button("Tile Mode", ButtonSkin.Default, Anchor.CenterLeft, new Vector2(300, 60), new Vector2(305, 0));

            tileMode.OnClick = (GeonBit.UI.Entities.Entity btn) =>
            {
                editorMode = EditorMode.TileMode;
            };
            menuBar.AddChild(tileMode);

            Button entityMode = new Button("Entity Mode", ButtonSkin.Default, Anchor.CenterLeft, new Vector2(300, 60), new Vector2(610, 0));

            entityMode.OnClick = (GeonBit.UI.Entities.Entity btn) =>
            {
                editorMode = EditorMode.EntityMode;
            };
            menuBar.AddChild(entityMode);

            Button collisionMode = new Button("Collision Mode", ButtonSkin.Default, Anchor.CenterLeft, new Vector2(350, 60), new Vector2(915, 0));

            collisionMode.OnClick = (GeonBit.UI.Entities.Entity btn) =>
            {
                editorMode = EditorMode.CollisionMode;
            };
            menuBar.AddChild(collisionMode);

            Panel propertyPanel = new Panel(new Vector2(1280, 720), PanelSkin.Default, Anchor.Center, null);

            propertyPanel.Visible      = false;
            propertyPanel.OnMouseEnter = (GeonBit.UI.Entities.Entity entity) =>
            {
                overUI = true;
            };
            propertyPanel.OnMouseLeave = (GeonBit.UI.Entities.Entity entity) =>
            {
                overUI = false;
            };
            UIManager.AddEntity(propertyPanel);

            Header propertyHeader = new Header("Map Properties", Anchor.TopCenter, null);

            propertyPanel.AddChild(propertyHeader);

            Button closePropertyPanle = new Button("X", ButtonSkin.Default, Anchor.TopRight, new Vector2(100, 50), new Vector2(0, -10));

            closePropertyPanle.OnClick = (GeonBit.UI.Entities.Entity btn) =>
            {
                propertyPanel.Visible = !propertyPanel.Visible;
            };
            propertyPanel.AddChild(closePropertyPanle);

            HorizontalLine propertyLine = new HorizontalLine(Anchor.TopCenter, new Vector2(0, 50));

            propertyPanel.AddChild(propertyLine);

            Paragraph mapRow = new Paragraph("Rows: ", Anchor.Center, null, null);

            propertyPanel.AddChild(mapRow);

            Button mapProperties = new Button("Map Properties", ButtonSkin.Default, Anchor.CenterLeft, new Vector2(350, 60), new Vector2(1270, 0));

            mapProperties.OnClick = (GeonBit.UI.Entities.Entity btn) =>
            {
                propertyPanel.Visible = !propertyPanel.Visible;
            };
            menuBar.AddChild(mapProperties);
        }
Ejemplo n.º 24
0
        static void Main(string[] args)
        {
            Engine engine = Engine.Instance;

            Screen screen = new Screen();

            engine.ActiveScreen = screen;
            engine.DebugEnabled = true;

            Tabs tabs = new Tabs(screen, new[] { "Texts", "Forms", "Drawings", "Charts", "Spinners", "Tables" }, 77, 26)
            {
                X = 1,
                Y = 2
            };

            StatusBar statusBar = new StatusBar(screen)
            {
                TextLeft   = "Left Text",
                TextCenter = "Status Bar",
                TextRight  = "Right Text"
            };

            MenuBar menuBar = new MenuBar(screen, new MenuItem(" ==CLIForms== ", null, true,
                                                               new MenuItem("Menu 1",
                                                                            new MenuItem("Item 1",
                                                                                         new MenuItem("Sub-Item 1"),
                                                                                         new MenuItem("Sub-Item 2"))
                                                                            , new MenuItem("Item 2")
                                                                            , new MenuItem("Item looong")),
                                                               new MenuItem("Menu 2"),
                                                               new MenuItem("Menu 3")));


            // ==== Texts Tab ====

            Label simpleLabel = new Label(null, "Simple Label")
            {
                X = 1,
                Y = 1
            };

            tabs.AddChild(simpleLabel, "Texts");

            Label multiLinesLabel = new Label(null, "Multi\nLines\nLabel")
            {
                X = 1,
                Y = 3
            };

            tabs.AddChild(multiLinesLabel, "Texts");

            FIG fig = new FIG(null, "FIGLet", "dosrebel")
            {
                X = 1,
                Y = 10
            };

            tabs.AddChild(fig, "Texts");

            // ==== Forms Tab ====

            Button button = new Button(null, "Button")
            {
                X     = 1,
                Y     = 1,
                Width = 10
            };

            tabs.AddChild(button, "Forms");

            Textbox simpleTextbox = new Textbox(null, "", "PlaceHolder", width: 20)
            {
                X = 1,
                Y = 5
            };

            tabs.AddChild(simpleTextbox, "Forms");

            Textbox simpleTextboxPwd = new Textbox(null, "", "Password", width: 20)
            {
                X          = 1,
                Y          = 7,
                IsPassword = true
            };

            tabs.AddChild(simpleTextboxPwd, "Forms");

            Checkbox checkbox = new Checkbox(null, "Checkbox")
            {
                X = 1,
                Y = 9
            };

            tabs.AddChild(checkbox, "Forms");

            Radio radio1 = new Radio(null, "Radio 1")
            {
                X = 1,
                Y = 12
            };

            tabs.AddChild(radio1, "Forms");

            Radio radio2 = new Radio(null, "Radio 2")
            {
                X = 1,
                Y = 14
            };

            tabs.AddChild(radio2, "Forms");

            Toggle toggle = new Toggle(null, "toggle")
            {
                X = 1,
                Y = 16
            };

            tabs.AddChild(toggle, "Forms");

            SingleLineListBox singleLineTextbox = new SingleLineListBox(null, new[]
            {
                new { id = 1, Text = "First Element" },
                new { id = 2, Text = "Second Element" },
                new { id = 3, Text = "Third Element" }
            }, "List Box")
            {
                X = 25,
                Y = 2,
                DisplayProperty = "Text"
            };

            tabs.AddChild(singleLineTextbox, "Forms");

            // ==== Drawings Tab ====
            Box box = new Box(null, 20, 10)
            {
                X = 1,
                Y = 1
            };

            tabs.AddChild(box, "Drawings");

            VericalLine vline = new VericalLine(null, 15)
            {
                X = 25,
                Y = 1
            };

            tabs.AddChild(vline, "Drawings");

            HorizontalLine hline = new HorizontalLine(null, 15)
            {
                X    = 27,
                Y    = 1,
                End1 = LineEndingStyle.T,
                End2 = LineEndingStyle.Plus
            };

            tabs.AddChild(hline, "Drawings");

            // ==== Charts Tab ====

            HorizontalChart hchart = new HorizontalChart(null, new List <float>()
            {
                0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
            })
            {
                X      = 1,
                Y      = 1,
                Height = 7,
                DataForegroundColor = new[] { ConsoleColor.Cyan, ConsoleColor.Green, ConsoleColor.Magenta },
                ChartType           = ChartType.Point
            };

            tabs.AddChild(hchart, "Charts");

            // ==== Spinner Tab ====
            TinySpinner tinySpinner = new TinySpinner(null)
            {
                X = 1,
                Y = 1
            };

            tabs.AddChild(tinySpinner, "Spinners");

            Spinner spinner = new Spinner(null)
            {
                X = 4,
                Y = 1
            };

            tabs.AddChild(spinner, "Spinners");

            SpinnerBar spinnerBar = new SpinnerBar(null)
            {
                X = 8,
                Y = 1
            };

            tabs.AddChild(spinnerBar, "Spinners");

            // ==== Tables Tab ====
            SimpleTable table = new SimpleTable(null)
            {
                X                 = 1,
                Y                 = 1,
                ColumnCount       = 5,
                LineCount         = 4,
                ColumnsWidth      = new[] { 4, 15, 15, 5, 15 },
                ColumnsAlignments = new[]
                {
                    AlignmentStyle.Right, AlignmentStyle.Left, AlignmentStyle.Left, AlignmentStyle.Right,
                    AlignmentStyle.Left
                },
                TableStyle = TableStyle.CompactWithHeaderNoExtBorder
            };


            table[0] = new [] { "ID", "Name", "Surname", "Age", "Town" };

            table[0, 1] = "1";
            table[1, 1] = "John";
            table[2, 1] = "Doe";
            table[3, 1] = "25";
            table[4, 1] = "Paris";

            table[0, 2] = "2";
            table[1, 2] = "Mickel";
            table[2, 2] = "Mercy";
            table[3, 2] = "30";
            table[4, 2] = "Luxembourg";

            table[0, 3] = "3";
            table[1, 3] = "Albert";
            table[2, 3] = "Wood";
            table[3, 3] = "18";
            table[4, 3] = "JacksonVille";

            tabs.AddChild(table, "Tables");

            //tabs.ActiveTab = 3;

            engine.Start();

            // Console.ReadLine();
        }
Ejemplo n.º 25
0
        protected override void Init()
        {
            k  = 0;          // Для першого входження -
            kf = 0.090909;

            _frInd       = GetIndicator <Fractals>(Instrument.Id, Timeframe);
            _frInd.Range = frac - 2;

            dlt = dl * Instrument.Point;         // Отступ от стопа


            frU1 = 0.0; frU2 = 0.0; frU3 = 0.0; frD1 = 0.0; frD2 = 0.0; frD3 = 0.0;
            if (tu)
            {
                zmax = dt1 * Instrument.Point;
                frU1 = fr1 * Instrument.Point; tmU1 = tm1;
                frU2 = fr2 * Instrument.Point; tmU2 = tm2;
                frU3 = fr2 * Instrument.Point; tmU3 = tm2;
                toolTriangle.Point1 = new ChartPoint(tmU1, frU1);
                toolTriangle.Point2 = new ChartPoint(tmU2, frU2);
                toolTriangle.Point3 = new ChartPoint(tmU3, frU3);
                XXPrint("INIT - {0} - frU1={1} frU2={2} frU3={3} - zmax={4}", Bars[Bars.Range.To - frac].Time, frU1, frU2, frU3, zmax);
            }
            if (td)
            {
                zmin = dt1 * Instrument.Point;
                frD1 = fr1 * Instrument.Point; tmD1 = tm1;
                frD2 = fr2 * Instrument.Point; tmD2 = tm2;
                frD3 = fr2 * Instrument.Point; tmD3 = tm2;
                toolTriangle.Point1 = new ChartPoint(tmD1, frD1);
                toolTriangle.Point2 = new ChartPoint(tmD2, frD2);
                toolTriangle.Point3 = new ChartPoint(tmD3, frD3);
                XXPrint("INIT - {0} - frD1={1} frD2={2} frD3={3} - zmin={4}", Bars[Bars.Range.To - frac].Time, frD1, frD2, frD3, zmin);
            }
            InitLogFile();              // Запись логов
            // Прямоугольники
            toolRectangle            = Tools.Create <Rectangle>(); toolRectangle.BorderColor = Color.Aqua; toolRectangle.Color = Color.DarkSeaGreen; toolRectangle.BorderColor = Color.Blue;
            toolRectangle1           = Tools.Create <Rectangle>(); toolRectangle1.BorderColor = Color.Aqua; toolRectangle1.Color = Color.DarkSeaGreen;
            toolArrowUp              = Tools.Create <ArrowUp>();
            toolArrowDown            = Tools.Create <ArrowDown>();
            toolTriangle             = Tools.Create <Triangle>();
            toolTriangle.Color       = Color.DarkSeaGreen;
            toolTriangle.BorderColor = Color.Blue;
            toolTriangle.BorderWidth = 2;
            NKZText          = Tools.Create <Text>();
            NKZText.Color    = Color.Blue;
            NKZText.FontSize = 12;

            lnkz = Tools.Create <HorizontalLine>();



            ki = 0;

            // 10/09/2018
            if (Instrument.Name == "EURUSD")
            {
                NKZ = 506;
            }
            if (Instrument.Name == "GBPUSD")
            {
                NKZ = 660;
            }
            if (Instrument.Name == "USDJPY")
            {
                NKZ = 570;
            }
            if (Instrument.Name == "USDCHF")
            {
                NKZ = 551;
            }
            if (Instrument.Name == "AUDUSD")
            {
                NKZ = 343;
            }
            if (Instrument.Name == "USDCAD")
            {
                NKZ = 508;
            }
            if (Instrument.Name == "NZDUSD")
            {
                NKZ = 330;
            }
            if (Instrument.Name == "AUDCAD")
            {
                NKZ = 357;
            }
            if (Instrument.Name == "AUDJPY")
            {
                NKZ = 550;
            }
            if (Instrument.Name == "AUDNZD")
            {
                NKZ = 412;
            }
            if (Instrument.Name == "CHFJPY")
            {
                NKZ = 1430;
            }
            if (Instrument.Name == "EURAUD")
            {
                NKZ = 682;
            }
            if (Instrument.Name == "EURCAD")
            {
                NKZ = 726;
            }
            if (Instrument.Name == "EURCHF")
            {
                NKZ = 682;
            }
            if (Instrument.Name == "EURGBP")
            {
                NKZ = 484;
            }
            if (Instrument.Name == "EURJPY")
            {
                NKZ = 781;
            }
            if (Instrument.Name == "GBPCHF")
            {
                NKZ = 924;
            }
            if (Instrument.Name == "GBPJPY")
            {
                NKZ = 1045;
            }
            Print("END-1");
        }
Ejemplo n.º 26
0
        protected override void Init()
        {
            k  = 0;          // Для першого входження -
            kf = 0.090909;

            dlt = dl * Instrument.Point;         // Отступ от стопа


            frU1 = 0.0; frU2 = 0.0; frU3 = 0.0; frD1 = 0.0; frD2 = 0.0; frD3 = 0.0;

            InitLogFile();              // Запись логов
            // Прямоугольники
            toolRectangle            = Tools.Create <Rectangle>(); toolRectangle.BorderColor = Color.Aqua; toolRectangle.Color = Color.DarkSeaGreen; toolRectangle.BorderColor = Color.Blue;
            toolRectangle1           = Tools.Create <Rectangle>(); toolRectangle1.BorderColor = Color.Aqua; toolRectangle1.Color = Color.DarkSeaGreen;
            toolArrowUp              = Tools.Create <ArrowUp>();
            toolArrowDown            = Tools.Create <ArrowDown>();
            toolTriangle             = Tools.Create <Triangle>();
            toolTriangle.Color       = Color.DarkSeaGreen;
            toolTriangle.BorderColor = Color.Blue;
            toolTriangle.BorderWidth = 2;
            NKZText          = Tools.Create <Text>();
            NKZText.Color    = Color.Blue;
            NKZText.FontSize = 12;

            lnkz = Tools.Create <HorizontalLine>();


            _frInd       = GetIndicator <Fractals>(Instrument.Id, Timeframe);
            _frInd.Range = frac - 2;

            ki = 0;

            // 10/09/2018
            if (Instrument.Name == "EURUSD")
            {
                NKZ = 506;
            }
            if (Instrument.Name == "GBPUSD")
            {
                NKZ = 660;
            }
            if (Instrument.Name == "USDJPY")
            {
                NKZ = 570;
            }
            if (Instrument.Name == "USDCHF")
            {
                NKZ = 551;
            }
            if (Instrument.Name == "AUDUSD")
            {
                NKZ = 343;
            }
            if (Instrument.Name == "USDCAD")
            {
                NKZ = 508;
            }
            if (Instrument.Name == "NZDUSD")
            {
                NKZ = 330;
            }
            if (Instrument.Name == "AUDCAD")
            {
                NKZ = 357;
            }
            if (Instrument.Name == "AUDJPY")
            {
                NKZ = 550;
            }
            if (Instrument.Name == "AUDNZD")
            {
                NKZ = 412;
            }
            if (Instrument.Name == "CHFJPY")
            {
                NKZ = 1430;
            }
            if (Instrument.Name == "EURAUD")
            {
                NKZ = 682;
            }
            if (Instrument.Name == "EURCAD")
            {
                NKZ = 726;
            }
            if (Instrument.Name == "EURCHF")
            {
                NKZ = 682;
            }
            if (Instrument.Name == "EURGBP")
            {
                NKZ = 484;
            }
            if (Instrument.Name == "EURJPY")
            {
                NKZ = 781;
            }
            if (Instrument.Name == "GBPCHF")
            {
                NKZ = 924;
            }
            if (Instrument.Name == "GBPJPY")
            {
                NKZ = 1045;
            }
        }
Ejemplo n.º 27
0
        void ReleaseDesignerOutlets()
        {
            if (GameModeLabel != null)
            {
                GameModeLabel.Dispose();
                GameModeLabel = null;
            }

            if (BGBox != null)
            {
                BGBox.Dispose();
                BGBox = null;
            }

            if (TextArea != null)
            {
                TextArea.Dispose();
                TextArea = null;
            }

            if (VerticalLine != null)
            {
                VerticalLine.Dispose();
                VerticalLine = null;
            }

            if (HorizontalLine != null)
            {
                HorizontalLine.Dispose();
                HorizontalLine = null;
            }

            if (AccuracyText != null)
            {
                AccuracyText.Dispose();
                AccuracyText = null;
            }

            if (SpeedText != null)
            {
                SpeedText.Dispose();
                SpeedText = null;
            }

            if (DurationText != null)
            {
                DurationText.Dispose();
                DurationText = null;
            }

            if (AccuracyNum != null)
            {
                AccuracyNum.Dispose();
                AccuracyNum = null;
            }

            if (SpeedNum != null)
            {
                SpeedNum.Dispose();
                SpeedNum = null;
            }

            if (DurationNum != null)
            {
                DurationNum.Dispose();
                DurationNum = null;
            }

            if (BGBoxWhite != null)
            {
                BGBoxWhite.Dispose();
                BGBoxWhite = null;
            }

            if (InputBox != null)
            {
                InputBox.Dispose();
                InputBox = null;
            }
        }
Ejemplo n.º 28
0
        public PlotMockup()
        {
            infoText  = "";
            infoText += "THE TEST (can your charting library handle this?) - \n";
            infoText += "NPlot demonstrates it can handle real world charting requirements.";

            // first of all, generate some mockup data.
            DataTable info = new DataTable("Store Information");

            info.Columns.Add("Index", typeof(int));
            info.Columns.Add("IndexOffsetLeft", typeof(float));
            info.Columns.Add("IndexOffsetRight", typeof(float));
            info.Columns.Add("StoreName", typeof(string));
            info.Columns.Add("BarBase", typeof(float));
            info.Columns.Add("StoreGrowth", typeof(float));
            info.Columns.Add("AverageGrowth", typeof(float));
            info.Columns.Add("ProjectedSales", typeof(float));

            float  barBase = 185.0f;
            Random r       = new Random();

            for (int i = 0; i < 18; ++i)
            {
                DataRow row = info.NewRow();
                row["Index"]            = i;
                row["IndexOffsetLeft"]  = (float)i - 0.1f;
                row["IndexOffsetRight"] = (float)i + 0.1f;
                row["StoreName"]        = "Store " + (i + 1).ToString();
                row["BarBase"]          = barBase;
                row["StoreGrowth"]      = barBase + ((r.NextDouble() - 0.1) * 20.0f);
                row["AverageGrowth"]    = barBase + ((r.NextDouble() - 0.1) * 15.0f);
                row["ProjectedSales"]   = barBase + (r.NextDouble() * 15.0f);
                info.Rows.Add(row);
                barBase += (float)r.NextDouble() * 4.0f;
            }

            plotSurface.Clear();

            plotSurface.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;

            // generate the grid
            Grid grid = new Grid();

            grid.VerticalGridType   = Grid.GridType.Coarse;
            grid.HorizontalGridType = Grid.GridType.None;
            grid.MajorGridPen       = new Pen(Color.Black, 1.0f);
            plotSurface.Add(grid);

            // generate the trendline
            LinePlot trendline = new LinePlot();

            trendline.DataSource   = info;
            trendline.AbscissaData = "Index";
            trendline.OrdinateData = "BarBase";
            trendline.Pen          = new Pen(Color.Black, 3.0f);
            trendline.Label        = "Trendline";
            plotSurface.Add(trendline);

            // draw store growth bars
            BarPlot storeGrowth = new BarPlot();

            storeGrowth.DataSource         = info;
            storeGrowth.AbscissaData       = "IndexOffsetLeft";
            storeGrowth.OrdinateDataTop    = "StoreGrowth";
            storeGrowth.OrdinateDataBottom = "BarBase";
            storeGrowth.Label     = "Store Growth";
            storeGrowth.FillBrush = NPlot.RectangleBrushes.Solid.Black;
            //storeGrowth.BorderPen = new Pen( Color.Black, 2.0f );
            plotSurface.Add(storeGrowth);

            // draw average growth bars
            BarPlot averageGrowth = new BarPlot();

            averageGrowth.DataSource         = info;
            averageGrowth.AbscissaData       = "IndexOffsetRight";
            averageGrowth.OrdinateDataBottom = "BarBase";
            averageGrowth.OrdinateDataTop    = "AverageGrowth";
            averageGrowth.Label     = "Average Growth";
            averageGrowth.FillBrush = NPlot.RectangleBrushes.Solid.Gray;
            //averageGrowth.BorderPen = new Pen( Color.Black, 2.0f );
            plotSurface.Add(averageGrowth);

            // generate the projected sales step line.
            StepPlot projected = new StepPlot();

            projected.DataSource           = info;
            projected.AbscissaData         = "Index";
            projected.OrdinateData         = "ProjectedSales";
            projected.Pen                  = new Pen(Color.Orange, 3.0f);
            projected.HideVerticalSegments = true;
            projected.Center               = true;
            projected.Label                = "Projected Sales";
            projected.WidthScale           = 0.7f;
            plotSurface.Add(projected);

            // generate the minimum target line.
            HorizontalLine minimumTargetLine = new HorizontalLine(218, new Pen(Color.Green, 3.5f));

            minimumTargetLine.Label        = "Minimum Target";
            minimumTargetLine.LengthScale  = 0.98f;
            minimumTargetLine.ShowInLegend = true;             // off by default for lines.
            plotSurface.Add(minimumTargetLine);

            // generate the preferred target line.
            HorizontalLine preferredTargetLine = new HorizontalLine(228, new Pen(Color.Blue, 3.5f));

            preferredTargetLine.Label        = "Preferred Target";
            preferredTargetLine.LengthScale  = 0.98f;
            preferredTargetLine.ShowInLegend = true;             // off by default for lines.
            plotSurface.Add(preferredTargetLine);

            // make some modifications so that chart matches requirements.
            // y axis.
            plotSurface.YAxis1.TicksIndependentOfPhysicalExtent = true;
            plotSurface.YAxis1.TickTextNextToAxis = false;
            //plotSurface.YAxis1.TicksAngle = 3.0f * (float)Math.PI / 2.0f; // Not required if TicksAngle bug #2000693 fixed
            ((LinearAxis)plotSurface.YAxis1).LargeTickStep      = 10.0;
            ((LinearAxis)plotSurface.YAxis1).NumberOfSmallTicks = 0;

            // x axis
            plotSurface.XAxis1.TicksIndependentOfPhysicalExtent = true;
            plotSurface.XAxis1.TickTextNextToAxis = false;
            //plotSurface.XAxis1.TicksAngle = (float)Math.PI / 2.0f; // Not required if TicksAngle bug #2000693 fixed
            LabelAxis la = new LabelAxis(plotSurface.XAxis1);

            for (int i = 0; i < info.Rows.Count; ++i)
            {
                la.AddLabel((string)info.Rows[i]["StoreName"], Convert.ToInt32(info.Rows[i]["Index"]));
            }
            la.TicksLabelAngle  = (float)90.0f;
            la.TicksBetweenText = true;
            plotSurface.XAxis1  = la;

            plotSurface.XAxis2 = (Axis)plotSurface.XAxis1.Clone();
            plotSurface.XAxis2.HideTickText  = true;
            plotSurface.XAxis2.LargeTickSize = 0;

            Legend l = new Legend();

            l.NumberItemsVertically = 2;
            l.AttachTo(XAxisPosition.Bottom, YAxisPosition.Left);
            l.HorizontalEdgePlacement = NPlot.Legend.Placement.Outside;
            l.VerticalEdgePlacement   = NPlot.Legend.Placement.Inside;
            l.XOffset     = 5;
            l.YOffset     = 50;
            l.BorderStyle = NPlot.LegendBase.BorderType.Line;

            plotSurface.Legend = l;

            plotSurface.Title =
                "Sales Growth Compared to\n" +
                "Average Sales Growth by Store Size - Rank Order Low to High";

            plotSurface.Refresh();
        }
Ejemplo n.º 29
0
        private void AddTimeStamp(PrintTask printTask, Color timeTextColor, FlowLayoutWidget primaryFlow)
        {
            var timestampColumn = new FlowLayoutWidget(FlowDirection.TopToBottom)
            {
                VAnchor         = VAnchor.Stretch,
                BackgroundColor = Color.LightGray,
                Padding         = new BorderDouble(6, 0)
            };

            var startTimeContainer = new FlowLayoutWidget
            {
                HAnchor = HAnchor.Stretch,
                Padding = new BorderDouble(0, 3)
            };

            string startLabelFull = "{0}:".FormatWith("Start".Localize().ToUpper());
            var    startLabel     = new TextWidget(startLabelFull, pointSize: 8)
            {
                TextColor = timeTextColor
            };

            string startTimeString = printTask.PrintStart.ToString("MMM d yyyy h:mm ") + printTask.PrintStart.ToString("tt").ToLower();
            var    startDate       = new TextWidget(startTimeString, pointSize: 12)
            {
                TextColor = timeTextColor
            };

            startTimeContainer.AddChild(startLabel);
            startTimeContainer.AddChild(new HorizontalSpacer());
            startTimeContainer.AddChild(startDate);

            var endTimeContainer = new FlowLayoutWidget
            {
                HAnchor = HAnchor.Stretch,
                Padding = new BorderDouble(0, 3)
            };

            string endLabelFull = "{0}:".FormatWith("End".Localize().ToUpper());
            var    endLabel     = new TextWidget(endLabelFull, pointSize: 8)
            {
                TextColor = timeTextColor
            };

            string endTimeString;

            if (printTask.PrintEnd != DateTime.MinValue)
            {
                endTimeString = printTask.PrintEnd.ToString("MMM d yyyy h:mm ") + printTask.PrintEnd.ToString("tt").ToLower();
            }
            else
            {
                endTimeString = "Unknown".Localize();
            }

            var endDate = new TextWidget(endTimeString, pointSize: 12)
            {
                TextColor = timeTextColor
            };

            endTimeContainer.AddChild(endLabel);
            endTimeContainer.AddChild(new HorizontalSpacer());
            endTimeContainer.AddChild(endDate);

            var horizontalLine = new HorizontalLine
            {
                BackgroundColor = Color.Gray
            };

            timestampColumn.AddChild(endTimeContainer);
            timestampColumn.AddChild(horizontalLine);
            timestampColumn.AddChild(startTimeContainer);

            timestampColumn.HAnchor = HAnchor.Stretch;
            timestampColumn.Padding = new BorderDouble(5, 0, 15, 0);

            primaryFlow.AddChild(timestampColumn);
        }
Ejemplo n.º 30
0
        public TouchscreenTabView(QueueDataView queueDataView)
            : base(Orientation.Vertical)
        {
            this.queueDataView          = queueDataView;
            this.TabBar.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
            this.TabBar.BorderColor     = new RGBA_Bytes(0, 0, 0, 0);
            this.TabBar.Margin          = new BorderDouble(4, 0, 0, 0);
            this.TabBar.Padding         = new BorderDouble(0, 8);

            this.Margin      = new BorderDouble(top: 0);
            this.TabTextSize = 18;

            string simpleModeString = UserSettings.Instance.get("IsSimpleMode");

            if (simpleModeString == null)
            {
                simpleMode = true;
                UserSettings.Instance.set("IsSimpleMode", "true");
            }
            else
            {
                simpleMode = Convert.ToBoolean(simpleModeString);
            }

            QueueTabPage = new TabPage(new QueueDataWidget(queueDataView), LocalizedString.Get("Queue").ToUpper());
            SimpleTextTabWidget queueTabWidget = new SimpleTextTabWidget(QueueTabPage, "Queue Tab", TabTextSize,
                                                                         ActiveTheme.Instance.SecondaryAccentColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes());

            partPreviewContainer = new PartPreviewContent(PrinterConnectionAndCommunication.Instance.ActivePrintItem, View3DWidget.WindowMode.Embeded, View3DWidget.AutoRotate.Enabled, View3DWidget.OpenMode.Viewing);

            string partPreviewLabel = LocalizedString.Get("Preview").ToUpper();

            this.AddTab(new SimpleTextTabWidget(new TabPage(partPreviewContainer, partPreviewLabel), "Part Preview Tab", TabTextSize,
                                                ActiveTheme.Instance.SecondaryAccentColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes()));

            string sliceSettingsLabel = LocalizedString.Get("Settings").ToUpper();

            sliceSettingsWidget = new SliceSettingsWidget();
            sliceTabPage        = new TabPage(sliceSettingsWidget, sliceSettingsLabel);

            this.AddTab(new SimpleTextTabWidget(sliceTabPage, "Slice Settings Tab", TabTextSize,
                                                ActiveTheme.Instance.SecondaryAccentColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes()));

            HorizontalLine lineSpacerZero = new HorizontalLine();

            lineSpacerZero.Margin = new BorderDouble(4, 10);
            this.TabBar.AddChild(lineSpacerZero);

            GuiWidget manualPrinterControls = new ManualControlsWidget();

#if __ANDROID__
            //Add the tab contents for 'Advanced Controls'
            string printerControlsLabel = LocalizedString.Get("Controls").ToUpper();
            manualControlsPage = new TabPage(manualPrinterControls, printerControlsLabel);
            this.AddTab(new SimpleTextTabWidget(manualControlsPage, "Controls Tab", TabTextSize,
                                                ActiveTheme.Instance.SecondaryAccentColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes()));
#else
            ScrollableWidget manualPrinterControlsScrollArea = new ScrollableWidget(true);
            manualPrinterControlsScrollArea.ScrollArea.HAnchor |= Agg.UI.HAnchor.ParentLeftRight;
            manualPrinterControlsScrollArea.AnchorAll();
            manualPrinterControlsScrollArea.AddChild(manualPrinterControls);

            //Add the tab contents for 'Advanced Controls'
            string printerControlsLabel = LocalizedString.Get("Controls").ToUpper();
            manualControlsPage = new TabPage(manualPrinterControlsScrollArea, printerControlsLabel);

            this.AddTab(new SimpleTextTabWidget(manualControlsPage, "Controls Tab", TabTextSize,
                                                ActiveTheme.Instance.SecondaryAccentColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes()));
#endif

            HorizontalLine lineSpacerOne = new HorizontalLine();
            lineSpacerOne.Margin = new BorderDouble(4, 10);
            this.TabBar.AddChild(lineSpacerOne);

            this.AddTab(queueTabWidget);

            LibraryTabPage = new TabPage(new PrintLibraryWidget(), LocalizedString.Get("Library").ToUpper());
            this.AddTab(new SimpleTextTabWidget(LibraryTabPage, "Library Tab", TabTextSize,
                                                ActiveTheme.Instance.SecondaryAccentColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes()));

            HistoryTabPage = new TabPage(new PrintHistoryWidget(), LocalizedString.Get("History").ToUpper());
            SimpleTextTabWidget historyTabWidget = new SimpleTextTabWidget(HistoryTabPage, "History Tab", TabTextSize,
                                                                           ActiveTheme.Instance.SecondaryAccentColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes());

            if (!simpleMode)
            {
                this.AddTab(historyTabWidget);
            }

            HorizontalLine lineSpacerTwo = new HorizontalLine();
            lineSpacerTwo.Margin = new BorderDouble(4, 10);
            this.TabBar.AddChild(lineSpacerTwo);

            string configurationLabel = LocalizedString.Get("Options").ToUpper();
            PrinterConfigurationScrollWidget printerConfigurationWidget = new PrinterConfigurationScrollWidget();

            // Make sure we have the right scroll position when we create this view
            // This is not working well enough. So, I disabled it until it can be fixed.
            // Specifically, it has the wronge position on the app restarting.
            if (false)
            {
                UiThread.RunOnIdle(() =>
                {
                    int scrollPosition = UserSettings.Instance.Fields.GetInt(CompactTabView_Options_ScrollPosition, -100000);
                    if (scrollPosition != -100000)
                    {
                        printerConfigurationWidget.ScrollPosition = new Vector2(0, scrollPosition);
                    }
                });

                printerConfigurationWidget.ScrollPositionChanged += (object sender, EventArgs e) =>
                {
                    UserSettings.Instance.Fields.SetInt(CompactTabView_Options_ScrollPosition, (int)printerConfigurationWidget.ScrollPosition.y);
                };
            }

            optionsPage = new TabPage(printerConfigurationWidget, configurationLabel);
            this.AddTab(new SimpleTextTabWidget(optionsPage, "Options Tab", TabTextSize,
                                                ActiveTheme.Instance.SecondaryAccentColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes()));

            TerminalTabPage = new TabPage(new TerminalWidget(false), LocalizedString.Get("Console").ToUpper());
            SimpleTextTabWidget terminalTabWidget = new SimpleTextTabWidget(TerminalTabPage, "Terminal Tab", TabTextSize,
                                                                            ActiveTheme.Instance.SecondaryAccentColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes());
            if (!simpleMode)
            {
                this.AddTab(terminalTabWidget);
            }

            AboutTabPage   = new TabPage(new AboutWidget(), LocalizedString.Get("About").ToUpper());
            aboutTabWidget = new SimpleTextTabWidget(AboutTabPage, "About Tab", TabTextSize,
                                                     ActiveTheme.Instance.SecondaryAccentColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes());
            this.AddTab(aboutTabWidget);

            NumQueueItemsChanged(this, null);
            SetUpdateNotification(this, null);

            QueueData.Instance.ItemAdded.RegisterEvent(NumQueueItemsChanged, ref unregisterEvents);
            QueueData.Instance.ItemRemoved.RegisterEvent(NumQueueItemsChanged, ref unregisterEvents);

            ActiveSliceSettings.ActivePrinterChanged.RegisterEvent((s, e) => ApplicationController.Instance.ReloadAdvancedControlsPanel(), ref unregisterEvents);

            PrinterConnectionAndCommunication.Instance.ActivePrintItemChanged.RegisterEvent((s, e) =>
            {
                // ReloadPartPreview
                UiThread.RunOnIdle(() =>
                {
                    partPreviewContainer.Reload(PrinterConnectionAndCommunication.Instance.ActivePrintItem);
                }, 1);
            }, ref unregisterEvents);

            ApplicationController.Instance.AdvancedControlsPanelReloading.RegisterEvent((s, e) => UiThread.RunOnIdle(ReloadAdvancedControls), ref unregisterEvents);
            UpdateControlData.Instance.UpdateStatusChanged.RegisterEvent(SetUpdateNotification, ref unregisterEvents);

            // Make sure we are on the right tab when we create this view
            {
                string selectedTab = UserSettings.Instance.get(CompactTabView_CurrentTab);
                this.SelectTab(selectedTab);

                TabBar.TabIndexChanged += (object sender, EventArgs e) =>
                {
                    string selectedTabName = TabBar.SelectedTabName;
                    if (!string.IsNullOrEmpty(selectedTabName))
                    {
                        UserSettings.Instance.set(CompactTabView_CurrentTab, selectedTabName);
                    }
                };
            }
        }
Ejemplo n.º 31
0
        public void Draw()
        {
            this.plot.PlotBackColor = Color.White;
            this.plot.BackColor     = Color.White;

            ArrayList xs1 = new ArrayList();

            ArrayList times = new ArrayList();

            int   split     = 1;
            long  lap       = 0;
            float max       = 0;
            float min       = 32767 * 32767;
            long  nlaps     = 0;
            long  totaltime = 0;

            this.plot.Clear();

            if (((long[])splits[winner]).Length < nsplits)
            {
                return;
            }

            for (int i = nsplits; i < ((long[])splits[winner]).Length; ++i)
            {
                lap += ((long[])splits[winner])[i];
                if (i != 0)
                {
                    lap -= ((long[])splits[winner])[i - 1];
                }
                if (split == nsplits)
                {
                    //times.Add("     " + timetostr(lap));
                    string time = "  " + timetostr(lap, true) + "  :  ";
                    for (int s = nsplits - 1; s >= 0; --s)
                    {
                        if (i == nsplits && s == nsplits)
                        {
                            time += timetostr(((long[])splits[winner])[i - s], false);
                        }
                        else
                        {
                            time += timetostr(((long[])splits[winner])[i - s] - ((long[])splits[winner])[i - 1 - s], false);
                        }
                        if (s != 0)
                        {
                            time += " , ";
                        }
                    }

                    time += "  ";
                    times.Add(time);
                    totaltime += lap;

                    ++nlaps;
                    if (max < lap)
                    {
                        max = lap;
                    }
                    if (min > lap)
                    {
                        min = lap;
                    }
                    xs1.Add((double)lap);
                    split = 1;
                    lap   = 0;
                }
                else
                {
                    split++;
                }
            }

            if (nlaps != 0)
            {
                this.winner_avgtime = totaltime / nlaps;
            }

            if (nlaps == 0)
            {
                return;
            }

            Grid mygrid = new Grid();

            mygrid.VerticalGridType   = Grid.GridType.Coarse;
            mygrid.HorizontalGridType = Grid.GridType.Coarse;
            mygrid.MajorGridPen       = new Pen(Color.LightGray, 1f);

            this.plot.Add(mygrid);

            for (int i = 0; i < xs1.Count; ++i)
            {
                double[] abscissa = { 0 };
                double[] ordinate = { 0 };

                if ((double)xs1[i] < winner_avgtime)
                {
                    abscissa[0] = (i);
                    ordinate[0] = ((double)xs1[i]) / 10000.0;
                    HistogramPlot hp = new HistogramPlot();
                    hp.OrdinateData = ordinate;
                    hp.AbscissaData = abscissa;

                    hp.RectangleBrush = new RectangleBrushes.Horizontal(Color.FromArgb(106, 205, 84), Color.FromArgb(235, 255, 213));
                    hp.Pen.Color      = Color.FromArgb(0, 150, 0);
                    hp.Filled         = true;
                    hp.ShowInLegend   = false;
                    this.plot.Add(hp);
                }

                if ((double)xs1[i] >= winner_avgtime)
                {
                    abscissa[0] = i;
                    if (Settings.LimitLapTimes && (((double)xs1[i] - winner_avgtime) > (winner_avgtime - min) * Settings.LimitMultiplier))
                    {
                        ordinate[0] = (winner_avgtime + (winner_avgtime - min) * Settings.LimitMultiplier) / 10000.0;
                    }
                    else
                    {
                        ordinate[0] = ((double)xs1[i]) / 10000.0;
                    }

                    HistogramPlot hp = new HistogramPlot();
                    hp.OrdinateData = ordinate;
                    hp.AbscissaData = abscissa;

                    if (Settings.LimitLapTimes && (((double)xs1[i] - winner_avgtime) > (winner_avgtime - min) * Settings.LimitMultiplier))
                    {
                        hp.RectangleBrush = new RectangleBrushes.Horizontal(Color.FromArgb(190, 39, 92), Color.FromArgb(235, 124, 177));
                    }
                    else
                    {
                        hp.RectangleBrush = new RectangleBrushes.Horizontal(Color.FromArgb(235, 84, 137), Color.FromArgb(255, 230, 210));
                    }
                    hp.Pen.Color    = Color.FromArgb(150, 0, 0);
                    hp.Filled       = true;
                    hp.ShowInLegend = false;
                    this.plot.Add(hp);
                }
            }

            //int xmax = ((long[])splits[winner]).Length / nsplits;

            LabelAxis la = new LabelAxis(this.plot.XAxis1);

            la.TicksBetweenText = false;
            la.TicksCrossAxis   = false;
            la.LargeTickSize    = 0;
            la.TickTextFont     = Settings.lapTimesFont;

            for (int i = 0; i < times.Count; ++i)
            {
                la.AddLabel((string)times[i], i);
            }

            la.TicksLabelAngle = -90.0f;
            this.plot.XAxis1   = la;

            la = new LabelAxis((LabelAxis)la.Clone());
            la.TicksBetweenText   = false;
            la.TicksCrossAxis     = true;
            la.LargeTickSize      = 2;
            la.TicksLabelAngle    = -90.0f;
            la.TickTextNextToAxis = false;
            la.TickTextFont       = Settings.commonFont;

            for (int i = 0; i < times.Count; ++i)
            {
                la.AddLabel(System.Convert.ToString(i + 2), i);
            }
            la.LabelFont     = Settings.commonFont;
            this.plot.XAxis2 = la;

            this.plot.YAxis1.TicksCrossAxis = true;

            this.plot.YAxis1.Label          = ((string)this.players[this.player]);
            this.plot.YAxis1.LabelFont      = Settings.titleFont;
            this.plot.YAxis1.LabelOffset    = 20;
            this.plot.YAxis1.NumberFormat   = "";
            this.plot.YAxis1.TicksCrossAxis = false;
            if (Settings.LimitToGlobalBestLap)
            {
                this.plot.YAxis1.WorldMin = (double)this.bestlap / 10000.0;
            }
            ((LinearAxis)this.plot.YAxis1).NumberOfSmallTicks = 4;
            ((LinearAxis)this.plot.YAxis1).LargeTickStep      = 1;
            ((LinearAxis)this.plot.YAxis1).TicksLabelAngle    = -90f;

            HorizontalLine hl = new HorizontalLine((float)winner_avgtime / 10000, Color.Gray);

            hl.Pen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dot;
            this.plot.Add(hl);

            this.laps = (int)nlaps;

            //            this.plot.YAxis1.WorldMax += 1;
            if (this.plot.YAxis1.WorldMax - this.plot.YAxis1.WorldMin <= 0.1)
            {
                this.plot.YAxis1.WorldMax += 1;
            }
            this.plot.Refresh();
            //            System.Console.WriteLine(System.Convert.ToString(this.plot.YAxis1.WorldMin) + " " + System.Convert.ToString(this.plot.YAxis1.WorldMax));
        }