Exemplo n.º 1
0
        public bool SaveFormDisplayInfo(IFormDisplayInfo displayInfo, string fileName)
        {
            displayInfo.Name = Path.GetFileNameWithoutExtension(fileName);
            JsonSerializerSettings settings = new JsonSerializerSettings {
                TypeNameHandling = TypeNameHandling.Auto
            };
            var json = JsonConvert.SerializeObject(displayInfo, settings);

            File.WriteAllText(fileName, json);
            return(true);
        }
Exemplo n.º 2
0
 public WaveformDisplay(
     IServiceProvider serviceProvider,
     log4net.ILog log,
     iRacingTelemetryOptions options,
     IFormDisplayInfo displayInfo)
     : this(
         serviceProvider,
         log,
         options)
 {
     this.FormDisplayInfo = displayInfo;
 }
Exemplo n.º 3
0
        protected virtual void LoadDisplay(IFormDisplayInfo displayInfo)
        {
            try
            {
                ((Form)Parent).SuspendLayout();

                ITelemetryForm displayForm = null;

                switch (displayInfo.DisplayType)
                {
                case (DisplayTypes.MdiParent):
                {
                    return;
                }

                case (DisplayTypes.LapTimes):
                {
                    displayForm = new LapTimesDisplay(
                        ServiceProvider,
                        Log,
                        Options);

                    break;
                }

                case (DisplayTypes.Waveform):
                {
                    displayForm = new WaveformDisplay(
                        ServiceProvider,
                        Log,
                        Options,
                        displayInfo);
                    break;
                }

                case (DisplayTypes.Histogram):
                {
                    displayForm = new HistogramDisplay(
                        ServiceProvider,
                        Log,
                        Options);
                    break;
                }

                case (DisplayTypes.TrackMap):
                {
                    displayForm = new TrackMapDisplay(
                        ServiceProvider,
                        Log,
                        Options);
                    break;
                }

                case (DisplayTypes.Setup):
                {
                    displayForm = new SetupDisplay(
                        ServiceProvider,
                        Log,
                        Options);
                    break;
                }

                case (DisplayTypes.SessionDetails):
                {
                    displayForm = new SessionDetailsDisplay(
                        ServiceProvider,
                        Log,
                        Options);
                    break;
                }
                }

                displayForm.FormDisplayInfo = displayInfo;

                displayForm.Text      = String.IsNullOrEmpty(displayInfo.Title) ? displayInfo.DisplayType.ToString() : displayInfo.Title;
                displayForm.MdiParent = (Form)Parent;

                displayForm.Location    = new System.Drawing.Point(displayInfo.X, displayInfo.Y);
                displayForm.Size        = new System.Drawing.Size(displayInfo.Width, displayInfo.Height);
                displayForm.WindowState = displayInfo.WindowState;

                displayForm.Show();

                MdiChildren.Add((IMdiChildForm)displayForm);
            }
            catch (Exception ex)
            {
                ExceptionHandler(ex);
            }
            finally
            {
                ((Form)Parent).ResumeLayout(true);
            }
        }