# HG changeset patch # User StephaneLenclud # Date 1366320310 -7200 # Node ID 9b09e2ee09680643ddb87c8225c87dd66a6c5fd1 # Parent 8c139748f17975f8804a7e1165858538800dc62a Front View plug-in does not init if no sensor added. Fixing some format to make strings shorter. Now trying to start SoundGraphAccess.exe process from same directory. Packed mode now can display three sensors along with the current time. diff -r 8c139748f179 -r 9b09e2ee0968 GUI/MainForm.cs --- a/GUI/MainForm.cs Thu Apr 18 19:51:05 2013 +0200 +++ b/GUI/MainForm.cs Thu Apr 18 23:25:10 2013 +0200 @@ -324,11 +324,6 @@ InitializePlotForm(); - - soundGraphDisplay.Init(); - - - startupMenuItem.Visible = startupManager.IsAvailable; if (startMinMenuItem.Checked) { diff -r 8c139748f179 -r 9b09e2ee0968 GUI/SensorFrontView.cs --- a/GUI/SensorFrontView.cs Thu Apr 18 19:51:05 2013 +0200 +++ b/GUI/SensorFrontView.cs Thu Apr 18 23:25:10 2013 +0200 @@ -157,13 +157,13 @@ { case SensorType.Voltage: format = "{0:F2}V"; break; case SensorType.Clock: format = "{0:F0}MHz"; break; - case SensorType.Load: format = "{0:F1}%"; break; + case SensorType.Load: format = "{0:F0}%"; break; //iMON VFD escape sequence for Celsius case SensorType.Temperature: format = "{0:F0}\x001A"; break; - case SensorType.Fan: format = "{0:F0}RPM"; break; + case SensorType.Fan: format = "{0:F0}*"; break; //RPM case SensorType.Flow: format = "{0:F0}L/h"; break; - case SensorType.Control: format = "{0:F1}%"; break; - case SensorType.Level: format = "{0:F1}%"; break; + case SensorType.Control: format = "{0:F0}%"; break; + case SensorType.Level: format = "{0:F0}%"; break; case SensorType.Power: format = "{0:F0}W"; break; case SensorType.Data: format = "{0:F0}GB"; break; case SensorType.Factor: format = "{0:F3}GB"; break; diff -r 8c139748f179 -r 9b09e2ee0968 GUI/SoundGraphDisplay.cs --- a/GUI/SoundGraphDisplay.cs Thu Apr 18 19:51:05 2013 +0200 +++ b/GUI/SoundGraphDisplay.cs Thu Apr 18 23:25:10 2013 +0200 @@ -53,19 +53,15 @@ Process[] processes = Process.GetProcessesByName("SoundGraphAccess"); if (!(processes.Length > 0)) { - - //Process client = UserAccountControl.CreateProcessAsStandardUser(@"D:\Dev\SoundGraphAccess\Debug\SoundGraphAccess.exe",""); - /* - Process client = new Process(); - client.StartInfo.FileName = @"D:\Dev\SoundGraphAccess\Debug\SoundGraphAccess.exe"; - client.StartInfo.WorkingDirectory = @"D:\Dev\SoundGraphAccess"; - client.Start();*/ + //Try to launch the sound graph process from the same folder as this executable + string exeName=System.IO.Path.GetDirectoryName(Application.ExecutablePath); + exeName += @"\SoundGraphAccess.exe"; + Process client = UserAccountControl.CreateProcessAsStandardUser(exeName,""); } //Start our SoundGraph server iServer = new SoundGraph.Server(@"\\.\pipe\sga-inbound", @"\\.\pipe\sga-outbound"); iServer.Start(); - //iServer.SendMessage("init:"); } private void HardwareRemoved(IHardware hardware) @@ -127,17 +123,25 @@ count++; sensor.Update(); + if (aDisplayTime && count == 1) + { + //First slot is take by time display + count++; + packedFirstLine = time + " "; + } + if (aPacked) { + //Build strings for packed mode string packedText = ""; packedText = sensor.iFirstLine.Substring(0, 3) + ":" + sensor.iSecondLine; if (count == 1) { - packedFirstLine = packedText; + packedFirstLine = packedText + " "; //Minimum one space to separate sensors on the same line } else if (count == 2) { - //Add enough spaces + //Add enough spaces to align to right hand side while (packedFirstLine.Length + packedText.Length < KMaxCharacterPerLine) { packedFirstLine += " "; @@ -146,19 +150,17 @@ } else if (count == 3) { - packedSecondLine = packedText; + packedSecondLine = packedText + " "; //Minimum one space to separate sensors on the same line } else if (count == 4) { - //Add enough spaces + //Add enough spaces to align to right hand side while (packedSecondLine.Length + packedText.Length < KMaxCharacterPerLine) { packedSecondLine += " "; } packedSecondLine += packedText; } - - } //SetText(sensor.iFirstLine, sensor.iSecondLine); } @@ -183,17 +185,11 @@ } } - if (aDisplayTime) - { - SetText(time, (iNextSensorToDisplay == 1 && packedSecondLine.Length > 0 ? packedSecondLine : packedFirstLine)); - } - else - { - //Display packed sensors on our FrontView display - SetText(packedFirstLine, packedSecondLine); - } + //TODO: Do something like that to cycle lines if ever we want to + //SetText(time, (iNextSensorToDisplay == 1 && packedSecondLine.Length > 0 ? packedSecondLine : packedFirstLine)); - + //Display packed sensors on our FrontView display + SetText(packedFirstLine, packedSecondLine); } else { @@ -248,6 +244,11 @@ //UpdateMainIconVisibilty(); settings.SetValue(new Identifier(sensor.Identifier, "FrontView").ToString(), true); iNextSensorToDisplay = 0; + if (list.Count == 1) + { + //Just added first sensor in FrontView, unable FrontView plug-in mode + Init(); + } } } @@ -256,6 +257,12 @@ { Remove(sensor, true); iNextSensorToDisplay = 0; + if (list.Count == 0) + { + //No sensor to display in FrontView, just disable FrontView plug-in mode + Uninit(); + } + } private void Remove(ISensor sensor, bool deleteConfig) diff -r 8c139748f179 -r 9b09e2ee0968 GUI/SoundGraphServer.cs --- a/GUI/SoundGraphServer.cs Thu Apr 18 19:51:05 2013 +0200 +++ b/GUI/SoundGraphServer.cs Thu Apr 18 23:25:10 2013 +0200 @@ -343,9 +343,9 @@ { byte[] Rc = new byte[ReadLength]; Buffer.BlockCopy(buffer, 0, Rc, 0, ReadLength); - - Trace.WriteLine(encoder.GetString(Rc, 0, ReadLength)); - Trace.WriteLine("Received " + ReadLength + " Bytes: " + encoder.GetString(Rc, 0, ReadLength)); + string msg = encoder.GetString(Rc, 0, ReadLength); + Trace.WriteLine(msg); + Trace.WriteLine("Received " + ReadLength + " Bytes: " + msg); buffer.Initialize(); }