From: <fr...@us...> - 2007-01-31 06:18:19
|
Revision: 58 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=58&view=rev Author: framug Date: 2007-01-30 22:18:14 -0800 (Tue, 30 Jan 2007) Log Message: ----------- Add My Status Plugin Added Paths: ----------- trunk/plugins/My Status/ trunk/plugins/My Status/GUIStatus.cs trunk/plugins/My Status/GUIStatusDetails.cs trunk/plugins/My Status/GUIStatusPrefs.cs trunk/plugins/My Status/My Status.csproj trunk/plugins/My Status/My Status.sln trunk/plugins/My Status/My Status.suo trunk/plugins/My Status/Properties/ trunk/plugins/My Status/Properties/AssemblyInfo.cs trunk/plugins/My Status/SetupForm.cs trunk/plugins/My Status/SetupForm.resx trunk/plugins/My Status/bin/ trunk/plugins/My Status/bin/Release/ trunk/plugins/My Status/bin/Release/Core.dll trunk/plugins/My Status/bin/Release/Dialogs.dll trunk/plugins/My Status/bin/Release/My Status.dll trunk/plugins/My Status/bin/Release/My Status.pdb trunk/plugins/My Status/bin/Release/Utils.dll trunk/plugins/My Status/bin/Release/mbm5.dll Added: trunk/plugins/My Status/GUIStatus.cs =================================================================== --- trunk/plugins/My Status/GUIStatus.cs (rev 0) +++ trunk/plugins/My Status/GUIStatus.cs 2007-01-31 06:18:14 UTC (rev 58) @@ -0,0 +1,905 @@ +/* + * Copyright (C) 2005 Team MediaPortal + * http://www.team-mediaportal.com + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Make; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * http://www.gnu.org/copyleft/gpl.html + * + */ + +#region Usings +using System; +using System.Drawing; +using System.Windows.Forms; +using System.Management; +using System.Collections; +using MediaPortal.Util; +using MediaPortal.GUI.Library; +using MediaPortal.Dialogs; +using MediaPortal.Player; +using MediaPortal.Playlists; +using mbm5.MBMInfo; +#endregion + +namespace MediaPortal.GUI.GUIStatus +{ + /// <summary> + /// Summary description for GUIStatus. + /// </summary> + public class GUIStatus : GUIWindow + { + public static int WINDOW_STATUS = 755; + + #region Private Enumerations + enum Controls + { + CONTROL_PREFERENCES = 2, // preference button + CONTROL_DETAIL = 3, // status details + CONTROL_NEXTPAGE = 4, // next page + CONTROL_STATUS = 9, // status text + CONTROL_1 = 10, + CONTROL_STATUSBAR = 9875 // status bar + }; + + enum SensorTypes + { + Volt = 1, + Fan = 2, + Percentage = 3, + Temperature = 4, + HD = 5, + Mhz = 6, + Ram = 7 + }; + + #endregion + + #region Private Variables + + private struct Sensor + { + public string name; + public string sname; + public int sensorNum; + public int sensorType; + public string drive; + public string first; + public string last; + public bool alarm; + public bool shutdown; + public long max; + public long min; + } + + private string soundFolder=""; + private string sound=""; + private int playTime=0; + private int maxSensors = 24; + private int pageSensors = 12; + private int numSensors = 0; + private static Sensor[] sensors = new Sensor[42]; + private bool starttimer=false; + private bool onWindow=false; + private bool onDetails=false; + private bool onStatus=false; + private bool showStatusBar=false; + private bool isMbm=false; + private bool page1=true; + private string statusBarSensor=""; + private bool showTopBottom=false; // true=show status bar on top false=bottom + private static bool alarm=false; + private static bool shutdown=false; + private static int selectedSensor=0; + private static string name=""; + private static int delayPlay=6; + private mbmSharedData MBMInfo=new mbmSharedData(); + private System.Windows.Forms.Timer statusTimer = new System.Windows.Forms.Timer(); + static bool m_bForceShutdown = true; // Force shutdown + + #endregion + + #region Constructor + public GUIStatus() + { + // + // TODO: Add constructor logic here + // + } + + #endregion + + #region Overrides + + public override int GetID + { + get { return WINDOW_STATUS; } + set { base.GetID = value; } + } + + public override bool Init() + { + onWindow=false; + onDetails=false; + onStatus=false; + //Log.Write("Start My Status"); + LoadSettings(); + InitializeStatusTimer(); + return Load (GUIGraphicsContext.Skin+@"\mystatus.xml"); + } + + public override void OnAction(Action action) + { + if (action.wID == Action.ActionType.ACTION_PREVIOUS_MENU) + { + onWindow=false; + onDetails=false; + onStatus=false; + GUIWindowManager.ShowPreviousWindow(); + return; + } + base.OnAction(action); + } + public override bool OnMessage(GUIMessage message) + { + switch ( message.Message ) + { + case GUIMessage.MessageType.GUI_MSG_WINDOW_INIT: + base.OnMessage(message); + onStatus=false; + onWindow=true; + onDetails=false; + page1=true; + ShowButtons(); + UpdateFields(); + LoadSound(); + GUIPropertyManager.SetProperty("#currentmodule", GUILocalizeStrings.Get(1950)); + return true; + case GUIMessage.MessageType.GUI_MSG_CLICKED: + //get sender control + base.OnMessage(message); + int iControl=message.SenderControlId; + if (iControl>=(int)Controls.CONTROL_1 && iControl<=((int)Controls.CONTROL_1 + maxSensors)) + { + selectedSensor=iControl; + alarm=sensors[selectedSensor-10].alarm; + name=sensors[selectedSensor-10].name; + onWindow=false; + onDetails=true; + onStatus=true; + GUIWindowManager.ActivateWindow(GUIStatusDetails.WINDOW_STATUS_DETAILS); + return true; + } + if (iControl==(int)Controls.CONTROL_PREFERENCES) // select preference page + { + onStatus=false; + onWindow=false; + onDetails=false; + GUIWindowManager.ActivateWindow(GUIStatusPrefs.WINDOW_STATUS_PREFS); + return true; + } + if (iControl==(int)Controls.CONTROL_NEXTPAGE) // select preference page + { + if(numSensors>12) + { + if (page1==true) + { + page1=false; + HideButtons(); + ShowButtons(); + } + else + { + page1=true; + HideButtons(); + ShowButtons(); + } + } + return true; + } + if (iControl==(int)Controls.CONTROL_DETAIL) // select status details + { + if (onStatus==false) // show textfield + { + onStatus=true; + onWindow=false; + onDetails=false; + HideButtons(); + GUIControl.HideControl( GetID,(int)Controls.CONTROL_NEXTPAGE); + GUIControl.DisableControl( GetID,(int)Controls.CONTROL_NEXTPAGE); + GUIControl.ShowControl( GetID,(int)Controls.CONTROL_STATUS); + GUIControl.EnableControl( GetID,(int)Controls.CONTROL_STATUS); + GUIControl.SetControlLabel(GetID,(int)Controls.CONTROL_DETAIL,GUILocalizeStrings.Get(712)); + return true; + } + else // hide textfield + { + onStatus=false; + onWindow=true; + onDetails=false; + GUIControl.HideControl( GetID,(int)Controls.CONTROL_STATUS); + GUIControl.DisableControl( GetID,(int)Controls.CONTROL_STATUS); + GUIControl.SetControlLabel(GetID,(int)Controls.CONTROL_DETAIL,GUILocalizeStrings.Get(1972)); + ShowButtons(); + return true; + } + } + return true; + case GUIMessage.MessageType.GUI_MSG_WINDOW_DEINIT: + onWindow=false; + break; + } + return base.OnMessage (message); + } + + #endregion + + #region Private Methods + + private void HideButtons() // Switch status buttons off + { + for (int i=(int)Controls.CONTROL_1;i<((int)Controls.CONTROL_1+pageSensors);i++) + { + GUIControl.HideControl( GetID,i ); + GUIControl.DisableControl( GetID,i ); + } + } + + private void ShowButtons() // Switch status buttons on + { + int st; + if (onStatus==false) + { + GUIControl.HideControl( GetID,(int)Controls.CONTROL_STATUS); + GUIControl.DisableControl( GetID,(int)Controls.CONTROL_STATUS); + } + if(numSensors>12) + { + GUIControl.ShowControl( GetID,(int)Controls.CONTROL_NEXTPAGE); + GUIControl.EnableControl( GetID,(int)Controls.CONTROL_NEXTPAGE); + } + else + { + GUIControl.HideControl( GetID,(int)Controls.CONTROL_NEXTPAGE); + GUIControl.DisableControl( GetID,(int)Controls.CONTROL_NEXTPAGE); + } + if (page1==true) + { + GUIControl.SetControlLabel(GetID,(int)Controls.CONTROL_NEXTPAGE,GUILocalizeStrings.Get(1975)); + if(numSensors>12) + { + st=(12+(int)Controls.CONTROL_1); + } + else + { + st=(numSensors+(int)Controls.CONTROL_1); + } + } + else + { + GUIControl.SetControlLabel(GetID,(int)Controls.CONTROL_NEXTPAGE,GUILocalizeStrings.Get(712)); + st=((numSensors-12)+(int)Controls.CONTROL_1); + } + for (int i=(int)Controls.CONTROL_1; i<((int)Controls.CONTROL_1+pageSensors); i++) + { + if (i<st) + { + GUIControl.ShowControl( GetID,i); + GUIControl.EnableControl( GetID,i); + } + else + { + GUIControl.HideControl( GetID,i ); + GUIControl.DisableControl( GetID,i ); + } + } + } + + /// <summary> + /// init 1 sec timer. + /// </summary> + private void InitializeStatusTimer() + { + statusTimer.Tick += new EventHandler(OnTimer); + statusTimer.Interval = 1000; //1 sec Intervall + statusTimer.Enabled=true; + statusTimer.Start(); + starttimer=true; + } + + private void OnTimer(Object sender, EventArgs e) + { + if(sender == statusTimer) + { + if (starttimer) UpdateFields(); + } + } + + /// <summary> + /// calculate KB,MB and GB View + /// </summary> + private string CalcExt(long m) + { + string lw=""; + if (m >= 10737418240) + { + m = (m / (1024 * 1024 * 1024)); + lw=m.ToString()+" GB"; + } + else if (m >= 1048576 ) + { + m = (m / (1024 * 1024)); + lw=m.ToString()+" MB"; + } + else if (m >= 1024 ) + { + m = (m / 1024); + lw=m.ToString()+" KB"; + } + return lw; + } + + /// <summary> + /// get infos of a disk + /// </summary> + private string GetDiskInfo(string lw) + { + ManagementObjectSearcher query; + ManagementObjectCollection queryCollection; + System.Management.ObjectQuery oq; + string stringMachineName = "localhost"; + long s=0; + long m=0; + string f=""; + string str=""; + //Connect to the remote computer + ConnectionOptions co = new ConnectionOptions(); + + //Point to machine + System.Management.ManagementScope ms = new System.Management.ManagementScope("\\\\" + stringMachineName + "\\root\\cimv2", co); + oq = new System.Management.ObjectQuery("SELECT * FROM Win32_LogicalDisk WHERE DeviceID = '"+lw+"'"); + query = new ManagementObjectSearcher(ms,oq); + queryCollection = query.Get(); + foreach ( ManagementObject mo in queryCollection) + { + m=Convert.ToInt64(mo["FreeSpace"]); + s=Convert.ToInt64(mo["Size"]); + f=Convert.ToString(mo["FileSystem"]); + } + str=lw+" "+CalcExt(m)+" "+GUILocalizeStrings.Get(1973)+" "+CalcExt(s)+" "+GUILocalizeStrings.Get(1953)+" "+GUILocalizeStrings.Get(1977)+": "+" "+f; + return str; + } + + /// <summary> + /// get the size of a disk + /// </summary> + private long GetDiskSize(string lw) + { + ManagementObjectSearcher query; + ManagementObjectCollection queryCollection; + System.Management.ObjectQuery oq; + string stringMachineName = "localhost"; + long s=0; + //Connect to the remote computer + ConnectionOptions co = new ConnectionOptions(); + + //Point to machine + System.Management.ManagementScope ms = new System.Management.ManagementScope("\\\\" + stringMachineName + "\\root\\cimv2", co); + oq = new System.Management.ObjectQuery("SELECT * FROM Win32_LogicalDisk WHERE DeviceID = '"+lw+"'"); + query = new ManagementObjectSearcher(ms,oq); + queryCollection = query.Get(); + foreach ( ManagementObject mo in queryCollection) + { + s=Convert.ToInt64(mo["Size"]); + } + return s; + } + + /// <summary> + /// get memory infos + /// </summary> + private string GetMemInfo() + { + string str=""; + try + { + ManagementClass memoryClass = new ManagementClass("Win32_OperatingSystem"); + ManagementObjectCollection memory = memoryClass.GetInstances(); + ManagementObjectCollection.ManagementObjectEnumerator memoryEnumerator = memory.GetEnumerator(); + memoryEnumerator.MoveNext(); + str=str+GUILocalizeStrings.Get(1974)+" "+Convert.ToString(memoryEnumerator.Current.Properties["FreePhysicalMemory"].Value) + " KB "; + str=str+GUILocalizeStrings.Get(1973)+" "+Convert.ToString(memoryEnumerator.Current.Properties["TotalVisibleMemorySize"].Value)+" KB "+GUILocalizeStrings.Get(1953)+"\n"; + str=str+GUILocalizeStrings.Get(1978)+": "+Convert.ToString(memoryEnumerator.Current.Properties["FreeVirtualMemory"].Value)+" KB "+GUILocalizeStrings.Get(1973); + str=str+" "+Convert.ToString(memoryEnumerator.Current.Properties["TotalVirtualMemorySize"].Value)+" KB "+GUILocalizeStrings.Get(1953)+"\n"; + } + catch {} + return str; + } + + private long GetFreeDiskLong(string lw) + { + ManagementObjectSearcher query; + ManagementObjectCollection queryCollection; + System.Management.ObjectQuery oq; + string stringMachineName = "localhost"; + long m=0; + //Connect to the remote computer + ConnectionOptions co = new ConnectionOptions(); + + //Point to machine + try + { + System.Management.ManagementScope ms = new System.Management.ManagementScope("\\\\" + stringMachineName + "\\root\\cimv2", co); + oq = new System.Management.ObjectQuery("SELECT * FROM Win32_LogicalDisk WHERE DeviceID = '"+lw+"'"); + query = new ManagementObjectSearcher(ms,oq); + queryCollection = query.Get(); + foreach ( ManagementObject mo in queryCollection) + { + m=Convert.ToInt64(mo["FreeSpace"]); + } + } + catch + { + } + return m; + } + + private string GetFreeDisk(string lw) + { + return CalcExt(GetFreeDiskLong(lw)); + } + + + private void UpdateFields() + { + int start=(int)Controls.CONTROL_1; + string s=""; + string text=""; + double act=0; + double max=0; + int p=0; + if (isMbm==true) + { + MBMInfo.Refresh(); + } + if (onStatus==true) // show status detail page + { + text=text+GetMemInfo()+"\n"; + for (int i=0; i<numSensors && i<=(int)Controls.CONTROL_1+maxSensors; i++) + { + if (sensors[i].sensorType==(int)SensorTypes.HD) + { + text=text+GetDiskInfo(sensors[i].drive)+"\n"; + } + else + { + text=text+String.Format("{0}: {1:0.##} {2}",sensors[i].sname,MBMInfo.Sensor(sensors[i].sensorNum).ssCurrent,sensors[i].last); + if (sensors[i].sensorType!=(int)SensorTypes.Mhz && sensors[i].sensorType!=(int)SensorTypes.Percentage) + { + text=text+" < "+String.Format("{0:0.##} {1}",MBMInfo.Sensor(sensors[i].sensorNum).ssLow,sensors[i].last); + text=text+" > "+String.Format("{0:0.##} {1}",MBMInfo.Sensor(sensors[i].sensorNum).ssHigh, sensors[i].last)+"\n"; + } + else + { + text=text+"\n"; + } + } + } + GUIControl.SetControlLabel(GetID, (int)Controls.CONTROL_STATUS, text ); + } + + // test threshold for each sensor + + for (int i=0; i<numSensors && i<=(int)Controls.CONTROL_1+maxSensors; i++) + { + if (showStatusBar==true) // show statusbar + { + if (statusBarSensor==sensors[i].sname) + { + GUIPropertyManager.SetProperty("#statusbar_name",sensors[i].name); + if(sensors[i].name=="lw") + { + act=Convert.ToDouble((GetFreeDiskLong(sensors[i].drive))); + max=GetDiskSize(sensors[i].drive); + p=100-Convert.ToInt16(act/(max/100)); + GUIPropertyManager.SetProperty("#statusbar_perc",p.ToString()); + GUIPropertyManager.SetProperty("#statusbar_act",act.ToString()); + } + else + { + if (sensors[i].name=="perc1") + { + GUIPropertyManager.SetProperty("#statusbar_perc",Convert.ToString((int)MBMInfo.Sensor(sensors[i].sensorNum).ssCurrent)); + GUIPropertyManager.SetProperty("#statusbar_act",Convert.ToString((int)MBMInfo.Sensor(sensors[i].sensorNum).ssCurrent)); + } + else + { + act=Convert.ToDouble(MBMInfo.Sensor(sensors[i].sensorNum).ssCurrent); + max=(double)sensors[i].max; + try + { + p=Convert.ToInt16(act/(max/100d)); + } + catch(Exception){} + GUIPropertyManager.SetProperty("#statusbar_perc",p.ToString()); + GUIPropertyManager.SetProperty("#statusbar_act",act.ToString()); + } + } + } + } + if (sensors[i].alarm==true) // is test alarm set? + { + switch (sensors[i].name) // which sensor + { + case "lw" : // hd + if ((GetFreeDiskLong(sensors[i].drive)/ (1024 * 1024))<sensors[i].min) Play(); + break; + case "fan1" : // Fan Sensor 1 + if (Convert.ToInt16(MBMInfo.Sensor(sensors[i].sensorNum).ssCurrent) <= sensors[i].min) Play(); + break; + case "fan2" : // Fan Sensor 2 + if (Convert.ToInt16(MBMInfo.Sensor(sensors[i].sensorNum).ssCurrent) <= sensors[i].min) Play(); + break; + case "fan3" : // Fan Sensor 3 + if (Convert.ToInt16(MBMInfo.Sensor(sensors[i].sensorNum).ssCurrent) <= sensors[i].min) Play(); + break; + case "temp1" : // Temp Sensor 1 + if (Convert.ToInt16(MBMInfo.Sensor(sensors[i].sensorNum).ssCurrent) >= sensors[i].max) + { + Play(); + if (shutdown==true) + { +//fmu Log.Write("Shutdown Temp Sensor 1 Alert"); + Log.Warn("Shutdown Temp Sensor 1 Alert"); + WindowsController.ExitWindows(RestartOptions.ShutDown, m_bForceShutdown); + } + } + break; + case "temp2" : // Temp Sensor 2 + if (Convert.ToInt16(MBMInfo.Sensor(sensors[i].sensorNum).ssCurrent) >= sensors[i].max) + { + Play(); + if (shutdown==true) + { + WindowsController.ExitWindows(RestartOptions.ShutDown, m_bForceShutdown); +// Log.Write("Shutdown Temp Sensor 1 Alert"); + Log.Warn("Shutdown Temp Sensor 1 Alert"); + } + } + break; + case "temp3" : // Temp Sensor 3 + if (Convert.ToInt16(MBMInfo.Sensor(sensors[i].sensorNum).ssCurrent) >= sensors[i].max) + { + Play(); + if (shutdown==true) + { + WindowsController.ExitWindows(RestartOptions.ShutDown, m_bForceShutdown); +//fmu Log.Write("Shutdown Temp Sensor 1 Alert"); + Log.Warn("Shutdown Temp Sensor 1 Alert"); + } + } + break; + } + } + } + if (onWindow==true || onDetails==true) + { + int st=0; + int offset=0; + int i=0; + if(page1==true) + { + st=numSensors; + } + else + { + st=numSensors-pageSensors; + offset=pageSensors; + } + i=offset; + for (int l=0; l<st && l<=(int)Controls.CONTROL_1+pageSensors; i++,l++) + { + if (sensors[i].sensorType==(int)SensorTypes.HD) + { + s=String.Format("{0} {1} {2}",sensors[i].first,GetFreeDisk(sensors[i].drive),sensors[i].last); + } + else + { + s=String.Format("{0}: {1:0.##} {2}",sensors[i].sname,MBMInfo.Sensor(sensors[i].sensorNum).ssCurrent,sensors[i].last); + } + + if (onWindow==true) GUIControl.SetControlLabel(GetID,start,s); + if (onDetails==true) + { + if (selectedSensor==start) + { + GUIPropertyManager.SetProperty("#sensor",s); + if (sensors[i].sensorType!=(int)SensorTypes.HD && sensors[i].sensorType!=(int)SensorTypes.Mhz) + { + GUIPropertyManager.SetProperty("#high",String.Format("{0}: {1:0.##}", GUILocalizeStrings.Get(1965),MBMInfo.Sensor(sensors[i].sensorNum).ssHigh)); + GUIPropertyManager.SetProperty("#low",String.Format("{0}: {1:0.##}",GUILocalizeStrings.Get(1966),MBMInfo.Sensor(sensors[i].sensorNum).ssLow)); + GUIPropertyManager.SetProperty("#alhigh",String.Format("{0}: {1:0.##}",GUILocalizeStrings.Get(1967),sensors[i].max)); + GUIPropertyManager.SetProperty("#allow",String.Format("{0}: {1:0.##}",GUILocalizeStrings.Get(1968),sensors[i].min)); + } + else + { + if (sensors[i].sensorType==(int)SensorTypes.Mhz) + { + GUIPropertyManager.SetProperty("#high"," "); + } + else + { + GUIPropertyManager.SetProperty("#high",GUILocalizeStrings.Get(1968)+" "+sensors[i].min.ToString()+" MB"); + } + GUIPropertyManager.SetProperty("#low"," "); + GUIPropertyManager.SetProperty("#alhigh"," "); + GUIPropertyManager.SetProperty("#allow"," "); + } + } + } + start++; + } + } + } + + public static bool IsShutdown() + { + return shutdown; + } + + public static bool IsAlarm() + { + return alarm; + } + + public static void SetShutdown(bool sh) + { + shutdown=sh; + } + + public static void SetAlarm(bool al) + { + sensors[selectedSensor-10].alarm=al; + } + + public static void SetInterval(int dl) + { + delayPlay=dl; + } + + public static int GetInterval() + { + return delayPlay; + } + + public static string GetName() + { + return name; + } + + private void Play() + { + try + { + if (playTime==0) + { + g_Player.Play(soundFolder + "\\" + sound); + g_Player.Volume=99; + } + playTime++; + if (playTime>delayPlay) playTime=0; + } + catch + { + } + } + + private void LoadSound() + { + using(MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings("MediaPortal.xml")) + { + soundFolder=xmlreader.GetValueAsString("status","status_sound_folder",""); + sound=xmlreader.GetValueAsString("status","status_sound",""); + } + } + + private void LoadSettings() + { + int num=0; + using(MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings("MediaPortal.xml")) + { + isMbm=xmlreader.GetValueAsBool("status","status_is_mbm",false); + showStatusBar=xmlreader.GetValueAsBool("status","status_bar_show",false); + if (showStatusBar==false) GUIPropertyManager.SetProperty("#statusbar_perc","-1"); + bool top=xmlreader.GetValueAsBool("status","status_bar_top",false); + bool bot=xmlreader.GetValueAsBool("status","status_bar_bottom",false); + if (top==true) showTopBottom=true; + if (bot==true) showTopBottom=false; + if (showTopBottom==true) + { + GUIPropertyManager.SetProperty("#statusbarTB","1"); + } + else + { + GUIPropertyManager.SetProperty("#statusbarTB","2"); + } + statusBarSensor=xmlreader.GetValueAsString("status","status_bar_sensor",""); + soundFolder=xmlreader.GetValueAsString("status","status_sound_folder","c:\\windows\\media"); + sound=xmlreader.GetValueAsString("status","status_sound","ding.wav"); + delayPlay=xmlreader.GetValueAsInt("status","status_sound_delay",6); + shutdown=xmlreader.GetValueAsBool("status","status_shutdown",false); + int hdt=xmlreader.GetValueAsInt("status","status_hd_threshold",200); + char drive='C'; + char ldrive='c'; + for (int i=0;i<24;i++) // read all drives + { + if (xmlreader.GetValueAsBool("status","status_lw"+ldrive,false)) + { + sensors[num].name="lw"; + sensors[num].sname=drive+":"; + sensors[num].drive=drive+":"; + sensors[num].min=hdt; + sensors[num].alarm=xmlreader.GetValueAsBool("status","status_lw"+ldrive+"al",false); + sensors[num].first=GUILocalizeStrings.Get(1951)+" "+drive+":"; + sensors[num].last=GUILocalizeStrings.Get(1953); + sensors[num++].sensorType=(int)SensorTypes.HD; + } + drive++; + ldrive++; + } + if (isMbm==true) + { + MBMInfo.Refresh(); + if (xmlreader.GetValueAsBool("status","status_temp1",false)) + { + sensors[num].name="temp1"; + sensors[num].sensorNum=xmlreader.GetValueAsInt("status","status_temp1i",0); + sensors[num].sname=Convert.ToString(MBMInfo.Sensor(sensors[num].sensorNum).ssName); + sensors[num].alarm=xmlreader.GetValueAsBool("status","status_temp1al",false); + sensors[num].shutdown=xmlreader.GetValueAsBool("status","status_temp1sh",false); + sensors[num].min=Convert.ToInt16(MBMInfo.Sensor(sensors[num].sensorNum).ssAlarm2); + sensors[num].max=Convert.ToInt16(MBMInfo.Sensor(sensors[num].sensorNum).ssAlarm1); + sensors[num].first=GUILocalizeStrings.Get(1954)+" 1:"; + sensors[num].last=GUILocalizeStrings.Get(1955); + sensors[num++].sensorType=(int)SensorTypes.Temperature; + } + if (xmlreader.GetValueAsBool("status","status_temp2",false)) + { + sensors[num].name="temp2"; + sensors[num].sensorNum=xmlreader.GetValueAsInt("status","status_temp2i",0); + sensors[num].sname=Convert.ToString(MBMInfo.Sensor(sensors[num].sensorNum).ssName); + sensors[num].alarm=xmlreader.GetValueAsBool("status","status_temp2al",false); + sensors[num].shutdown=xmlreader.GetValueAsBool("status","status_temp1sh",false); + sensors[num].min=Convert.ToInt16(MBMInfo.Sensor(sensors[num].sensorNum).ssAlarm2); + sensors[num].max=Convert.ToInt16(MBMInfo.Sensor(sensors[num].sensorNum).ssAlarm1); + sensors[num].first=GUILocalizeStrings.Get(1954)+" 2:"; + sensors[num].last=GUILocalizeStrings.Get(1955); + sensors[num++].sensorType=(int)SensorTypes.Temperature; + } + if (xmlreader.GetValueAsBool("status","status_temp3",false)) + { + sensors[num].name="temp3"; + sensors[num].sensorNum=xmlreader.GetValueAsInt("status","status_temp3i",0); + sensors[num].sname=Convert.ToString(MBMInfo.Sensor(sensors[num].sensorNum).ssName); + sensors[num].alarm=xmlreader.GetValueAsBool("status","status_temp3al",false); + sensors[num].shutdown=xmlreader.GetValueAsBool("status","status_temp1sh",false); + sensors[num].min=Convert.ToInt16(MBMInfo.Sensor(sensors[num].sensorNum).ssAlarm2); + sensors[num].max=Convert.ToInt16(MBMInfo.Sensor(sensors[num].sensorNum).ssAlarm1); + sensors[num].first=GUILocalizeStrings.Get(1954)+" 3:"; + sensors[num].last=GUILocalizeStrings.Get(1955); + sensors[num++].sensorType=(int)SensorTypes.Temperature; + } + if (xmlreader.GetValueAsBool("status","status_fan1",false)) + { + sensors[num].name="fan1"; + sensors[num].sensorNum=xmlreader.GetValueAsInt("status","status_fan1i",0); + sensors[num].sname=Convert.ToString(MBMInfo.Sensor(sensors[num].sensorNum).ssName); + sensors[num].alarm=xmlreader.GetValueAsBool("status","status_fan1al",false); + sensors[num].min=Convert.ToInt16(MBMInfo.Sensor(sensors[num].sensorNum).ssAlarm2); + sensors[num].max=Convert.ToInt16(MBMInfo.Sensor(sensors[num].sensorNum).ssAlarm1); + sensors[num].first=GUILocalizeStrings.Get(1952)+" 1:"; + sensors[num].last=GUILocalizeStrings.Get(1976); + sensors[num++].sensorType=(int)SensorTypes.Fan; + } + if (xmlreader.GetValueAsBool("status","status_fan2",false)) + { + sensors[num].name="fan2"; + sensors[num].sensorNum=xmlreader.GetValueAsInt("status","status_fan2i",0); + sensors[num].sname=Convert.ToString(MBMInfo.Sensor(sensors[num].sensorNum).ssName); + sensors[num].alarm=xmlreader.GetValueAsBool("status","status_fan2al",false); + sensors[num].min=Convert.ToInt16(MBMInfo.Sensor(sensors[num].sensorNum).ssAlarm2); + sensors[num].max=Convert.ToInt16(MBMInfo.Sensor(sensors[num].sensorNum).ssAlarm1); + sensors[num].first=GUILocalizeStrings.Get(1952)+" 2:"; + sensors[num].last=GUILocalizeStrings.Get(1976); + sensors[num++].sensorType=(int)SensorTypes.Fan; + } + if (xmlreader.GetValueAsBool("status","status_fan3",false)) + { + sensors[num].name="fan3"; + sensors[num].sensorNum=xmlreader.GetValueAsInt("status","status_fan3i",0); + sensors[num].sname=Convert.ToString(MBMInfo.Sensor(sensors[num].sensorNum).ssName); + sensors[num].alarm=xmlreader.GetValueAsBool("status","status_fan3al",false); + sensors[num].min=Convert.ToInt16(MBMInfo.Sensor(sensors[num].sensorNum).ssAlarm2); + sensors[num].max=Convert.ToInt16(MBMInfo.Sensor(sensors[num].sensorNum).ssAlarm1); + sensors[num].first=GUILocalizeStrings.Get(1952)+" 3:"; + sensors[num].last=GUILocalizeStrings.Get(1976); + sensors[num++].sensorType=(int)SensorTypes.Fan; + } + if (xmlreader.GetValueAsBool("status","status_volt1",false)) + { + sensors[num].name="volt1"; + sensors[num].sensorNum=xmlreader.GetValueAsInt("status","status_volt1i",0); + sensors[num].sname=Convert.ToString(MBMInfo.Sensor(sensors[num].sensorNum).ssName); + sensors[num].alarm=xmlreader.GetValueAsBool("status","status_volt1al",false); + sensors[num].min=Convert.ToInt16(MBMInfo.Sensor(sensors[num].sensorNum).ssAlarm2); + sensors[num].max=Convert.ToInt16(MBMInfo.Sensor(sensors[num].sensorNum).ssAlarm1); + sensors[num].first=GUILocalizeStrings.Get(1959)+" 1:"; + sensors[num].last=GUILocalizeStrings.Get(1960); + sensors[num++].sensorType=(int)SensorTypes.Volt; + } + if (xmlreader.GetValueAsBool("status","status_volt2",false)) + { + sensors[num].name="volt2"; + sensors[num].sensorNum=xmlreader.GetValueAsInt("status","status_volt2i",0); + sensors[num].sname=Convert.ToString(MBMInfo.Sensor(sensors[num].sensorNum).ssName); + sensors[num].alarm=xmlreader.GetValueAsBool("status","status_volt2al",false); + sensors[num].min=Convert.ToInt16(MBMInfo.Sensor(sensors[num].sensorNum).ssAlarm2); + sensors[num].max=Convert.ToInt16(MBMInfo.Sensor(sensors[num].sensorNum).ssAlarm1); + sensors[num].first=GUILocalizeStrings.Get(1959)+" 2:"; + sensors[num].last=GUILocalizeStrings.Get(1960); + sensors[num++].sensorType=(int)SensorTypes.Volt; + } + if (xmlreader.GetValueAsBool("status","status_volt3",false)) + { + sensors[num].name="volt3"; + sensors[num].sensorNum=xmlreader.GetValueAsInt("status","status_volt3i",0); + sensors[num].sname=Convert.ToString(MBMInfo.Sensor(sensors[num].sensorNum).ssName); + sensors[num].alarm=xmlreader.GetValueAsBool("status","status_volt3al",false); + sensors[num].min=Convert.ToInt16(MBMInfo.Sensor(sensors[num].sensorNum).ssAlarm2); + sensors[num].max=Convert.ToInt16(MBMInfo.Sensor(sensors[num].sensorNum).ssAlarm1); + sensors[num].first=GUILocalizeStrings.Get(1959)+" 3:"; + sensors[num].last=GUILocalizeStrings.Get(1960); + sensors[num++].sensorType=(int)SensorTypes.Volt; + } + if (xmlreader.GetValueAsBool("status","status_mhz1",false)) + { + sensors[num].name="mhz1"; + sensors[num].sensorNum=xmlreader.GetValueAsInt("status","status_mhz1i",0); + sensors[num].sname=Convert.ToString(MBMInfo.Sensor(sensors[num].sensorNum).ssName); + sensors[num].alarm=xmlreader.GetValueAsBool("status","status_mhz1al",false); + sensors[num].min=Convert.ToInt16(MBMInfo.Sensor(sensors[num].sensorNum).ssAlarm2); + sensors[num].max=Convert.ToInt16(MBMInfo.Sensor(sensors[num].sensorNum).ssAlarm1); + sensors[num].first=GUILocalizeStrings.Get(1961); + sensors[num].last="Mhz"; + sensors[num++].sensorType=(int)SensorTypes.Mhz; + } + if (xmlreader.GetValueAsBool("status","status_perc1",false)) + { + sensors[num].name="perc1"; + sensors[num].sensorNum=xmlreader.GetValueAsInt("status","status_perc1i",0); + sensors[num].sname=Convert.ToString(MBMInfo.Sensor(sensors[num].sensorNum).ssName); + sensors[num].alarm=xmlreader.GetValueAsBool("status","status_perc1al",false); + sensors[num].min=Convert.ToInt16(MBMInfo.Sensor(sensors[num].sensorNum).ssAlarm2); + sensors[num].max=Convert.ToInt16(MBMInfo.Sensor(sensors[num].sensorNum).ssAlarm1); + sensors[num].first=GUILocalizeStrings.Get(1958); + sensors[num].last="%"; + sensors[num++].sensorType=(int)SensorTypes.Percentage; + } + } + numSensors=num; + } + } + #endregion + } +} Added: trunk/plugins/My Status/GUIStatusDetails.cs =================================================================== --- trunk/plugins/My Status/GUIStatusDetails.cs (rev 0) +++ trunk/plugins/My Status/GUIStatusDetails.cs 2007-01-31 06:18:14 UTC (rev 58) @@ -0,0 +1,97 @@ +/* + * Copyright (C) 2005 Team MediaPortal + * http://www.team-mediaportal.com + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Make; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * http://www.gnu.org/copyleft/gpl.html + * + */ + +#region Usings +using System; +using System.Management; +using System.Collections; +using System.Windows.Forms; +using MediaPortal.GUI.Library; +using MediaPortal.Dialogs; +using mbm5.MBMInfo; +#endregion + +namespace MediaPortal.GUI.GUIStatus { + public class GUIStatusDetails : GUIWindow { + public static int WINDOW_STATUS_DETAILS = 756; + + private mbmSharedData MBMInfo=new mbmSharedData(); + + #region Private Enumerations + enum Controls { + CONTROL_BACK = 2, + CONTROL_ALARM = 3 + }; + #endregion + + #region Constructor + public GUIStatusDetails() { + // + // TODO: Add constructor logic here + // + GetID=GUIStatusDetails.WINDOW_STATUS_DETAILS; + } + #endregion + + #region Overrides + public override bool Init() { + return Load (GUIGraphicsContext.Skin+@"\mystatusdetails.xml"); + } + + public override void OnAction(Action action) { + if (action.wID == Action.ActionType.ACTION_CLOSE_DIALOG ||action.wID == Action.ActionType.ACTION_PREVIOUS_MENU) { + GUIWindowManager.ShowPreviousWindow(); + return; + } + base.OnAction(action); + } + + public override bool OnMessage(GUIMessage message) { + switch ( message.Message ) { + + case GUIMessage.MessageType.GUI_MSG_WINDOW_INIT: { + base.OnMessage(message); + ((GUIToggleButtonControl)GetControl((int)Controls.CONTROL_ALARM)).Selected = GUIStatus.IsAlarm(); + return true; + } + case GUIMessage.MessageType.GUI_MSG_CLICKED: + //get sender control + base.OnMessage(message); + int iControl=message.SenderControlId; + if (iControl==(int)Controls.CONTROL_BACK) { + SaveSettings(); + GUIWindowManager.ShowPreviousWindow(); + return true; + } + return true; + } + return base.OnMessage(message); + } + + private void SaveSettings() { + using(MediaPortal.Profile.Settings xmlwriter = new MediaPortal.Profile.Settings("MediaPortal.xml")) { + xmlwriter.SetValueAsBool("status","status_"+GUIStatus.GetName()+"al",((GUIToggleButtonControl)GetControl((int)Controls.CONTROL_ALARM)).Selected); + GUIStatus.SetAlarm(((GUIToggleButtonControl)GetControl((int)Controls.CONTROL_ALARM)).Selected); + } + } + } + #endregion +} Added: trunk/plugins/My Status/GUIStatusPrefs.cs =================================================================== --- trunk/plugins/My Status/GUIStatusPrefs.cs (rev 0) +++ trunk/plugins/My Status/GUIStatusPrefs.cs 2007-01-31 06:18:14 UTC (rev 58) @@ -0,0 +1,197 @@ +/* + * Copyright (C) 2005 Team MediaPortal + * http://www.team-mediaportal.com + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Make; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * http://www.gnu.org/copyleft/gpl.html + * + */ + +#region Usings +using System; +using System.Management; +using System.Collections; +using System.Windows.Forms; +using MediaPortal.Util; +using MediaPortal.Player; +using MediaPortal.GUI.Library; +using MediaPortal.Dialogs; +using mbm5.MBMInfo; +#endregion + +namespace MediaPortal.GUI.GUIStatus { + /// <summary> + /// Summary description for GUIStatusPrefs. + /// </summary> + public class GUIStatusPrefs : GUIWindow + { + public static int WINDOW_STATUS_PREFS = 757; + + #region Private Enumerations + enum Controls { + CONTROL_BACK = 2, + CONTROL_TEST = 3, + CONTROL_SPIN = 4, + CONTROL_SHUT = 5, + CONTROL_LIST = 10 + }; + #endregion + + #region Private Variables + private string soundFolder = string.Empty; + private string sound = string.Empty; + private int spin; + private GUIListItem selectedItem; + #endregion + + #region Constructor + public GUIStatusPrefs() { + // + // TODO: Add constructor logic here + // + GetID=GUIStatusPrefs.WINDOW_STATUS_PREFS; + } + #endregion + + #region Overrides + public override bool Init() { + return Load (GUIGraphicsContext.Skin+@"\mystatusprefs.xml"); + } + + public override void OnAction(Action action) { + if (action.wID == Action.ActionType.ACTION_CLOSE_DIALOG ||action.wID == Action.ActionType.ACTION_PREVIOUS_MENU) { + GUIWindowManager.ShowPreviousWindow(); + return; + } + base.OnAction(action); + } + + public override bool OnMessage(GUIMessage message) { + switch ( message.Message ) { + + case GUIMessage.MessageType.GUI_MSG_WINDOW_INIT: { + base.OnMessage(message); + LoadSettings(); + LoadListControl(); + GUISpinControl cntlYieldInterval=GetControl((int)Controls.CONTROL_SPIN) as GUISpinControl; + if (cntlYieldInterval!=null) { + for (int i=1; i <= 100; i++) cntlYieldInterval.AddLabel("",i); + cntlYieldInterval.Value=1; + } + cntlYieldInterval.Value=GUIStatus.GetInterval(); + ((GUIToggleButtonControl)GetControl((int)Controls.CONTROL_SHUT)).Selected = GUIStatus.IsShutdown(); + return true; + } + case GUIMessage.MessageType.GUI_MSG_CLICKED: + //get sender control + base.OnMessage(message); + int iControl=message.SenderControlId; + if (iControl==(int)Controls.CONTROL_SPIN) { + GUISpinControl cntlYieldInt=GetControl((int)Controls.CONTROL_SPIN) as GUISpinControl; + int iInterval=(cntlYieldInt.Value)+1; + GUIStatus.SetInterval(iInterval); + spin=iInterval; + } + if (iControl==(int)Controls.CONTROL_BACK) { + GUIStatus.SetShutdown(((GUIToggleButtonControl)GetControl((int)Controls.CONTROL_SHUT)).Selected); + SaveSettings(); + GUIWindowManager.ShowPreviousWindow(); + return true; + } + if (iControl==(int)Controls.CONTROL_TEST) { + Play(); + return true; + } + if (iControl==(int)Controls.CONTROL_LIST) { + GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_ITEM_SELECTED,GetID,0,iControl,0,0,null); + OnMessage(msg); + int iItem=(int)msg.Param1; + int iAction=(int)message.Param1; + if (iAction == (int)Action.ActionType.ACTION_SELECT_ITEM) { + GUIListItem item = GUIControl.GetSelectedListItem(GetID,iControl); + if (item!=null) { + sound = item.Label; + item.IconImage = "check-box.png"; + if(selectedItem != null) { + selectedItem.IconImage = string.Empty; + selectedItem=item; + } + GUIControl.RefreshControl(GetID,(int)Controls.CONTROL_LIST); + } + } + GUIControl.FocusControl(GetID, iControl); + return true; + } + return true; + } + return base.OnMessage(message); + } + #endregion + + #region Private Methods + /// <summary> + /// Loads the list control with the type of sound selected + /// </summary> + /// + private void LoadListControl() { + //clear the list + GUIControl.ClearControl(GetID,(int)Controls.CONTROL_LIST); + VirtualDirectory Directory; + ArrayList itemlist; + Directory = new VirtualDirectory(); + Directory.SetExtensions(Util.Utils.AudioExtensions); + itemlist = Directory.GetDirectory(soundFolder); + + foreach (GUIListItem item in itemlist) { + if(!item.IsFolder) { + GUIListItem pItem = new GUIListItem(item.FileInfo.Name); + if(pItem.Label == sound) { + pItem.IconImage = "check-box.png"; + selectedItem = pItem; + } + GUIControl.AddListItemControl(GetID,(int)Controls.CONTROL_LIST,pItem); + } + } + string strObjects =String.Format("{0} {1}",GUIControl.GetItemCount(GetID,(int)Controls.CONTROL_LIST).ToString(), GUILocalizeStrings.Get(632)); + GUIPropertyManager.SetProperty("#itemcount",strObjects); + } + + private void Play() { + try { + g_Player.Play(soundFolder + "\\" + sound); + g_Player.Volume=99; + } + catch { + } + } + + private void SaveSettings() { + using(MediaPortal.Profile.Settings xmlwriter = new MediaPortal.Profile.Settings("MediaPortal.xml")) { + xmlwriter.SetValueAsBool("status","status_shutdown",((GUIToggleButtonControl)GetControl((int)Controls.CONTROL_SHUT)).Selected); + xmlwriter.SetValue("status","status_sound",sound); + xmlwriter.SetValue("status","status_sound_delay",spin); + } + } + + private void LoadSettings() { + using(MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings("MediaPortal.xml")) { + soundFolder=xmlreader.GetValueAsString("status","status_sound_folder",""); + sound=xmlreader.GetValueAsString("status","status_sound",""); + } + } + #endregion + + } +} Added: trunk/plugins/My Status/My Status.csproj =================================================================== --- trunk/plugins/My Status/My Status.csproj (rev 0) +++ trunk/plugins/My Status/My Status.csproj 2007-01-31 06:18:14 UTC (rev 58) @@ -0,0 +1,77 @@ +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProductVersion>8.0.50727</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{55786500-26B8-412B-B5AB-6B965CE1218F}</ProjectGuid> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>MediaPortal.GUI.GUIStatus</RootNamespace> + <AssemblyName>My Status</AssemblyName> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="Core, Version=1.0.2582.36060, Culture=neutral, processorArchitecture=MSIL"> + <SpecificVersion>False</SpecificVersion> + <HintPath>D:\sources mp\xbmc\bin\Release\Core.dll</HintPath> + </Reference> + <Reference Include="Dialogs, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL"> + <SpecificVersion>False</SpecificVersion> + <HintPath>D:\sources mp\xbmc\bin\Release\plugins\windows\Dialogs.dll</HintPath> + </Reference> + <Reference Include="mbm5, Version=1.0.1778.42739, Culture=neutral"> + <SpecificVersion>False</SpecificVersion> + <HintPath>.\mbm5.dll</HintPath> + </Reference> + <Reference Include="System" /> + <Reference Include="System.Data" /> + <Reference Include="System.Drawing" /> + <Reference Include="System.Management" /> + <Reference Include="System.Windows.Forms" /> + <Reference Include="System.Xml" /> + <Reference Include="Utils, Version=1.0.2582.36059, Culture=neutral, processorArchitecture=MSIL"> + <SpecificVersion>False</SpecificVersion> + <HintPath>D:\sources mp\xbmc\bin\Release\Utils.dll</HintPath> + </Reference> + </ItemGroup> + <ItemGroup> + <Compile Include="GUIStatus.cs" /> + <Compile Include="GUIStatusDetails.cs" /> + <Compile Include="GUIStatusPrefs.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + <Compile Include="SetupForm.cs"> + <SubType>Form</SubType> + </Compile> + </ItemGroup> + <ItemGroup> + <EmbeddedResource Include="SetupForm.resx"> + <DependentUpon>SetupForm.cs</DependentUpon> + <SubType>Designer</SubType> + </EmbeddedResource> + </ItemGroup> + <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> + <!-- To modify your build process, add your task inside one of the targets below and uncomment it. + Other similar extension points exist, see Microsoft.Common.targets. + <Target Name="BeforeBuild"> + </Target> + <Target Name="AfterBuild"> + </Target> + --> +</Project> \ No newline at end of file Added: trunk/plugins/My Status/My Status.sln =================================================================== --- trunk/plugins/My Status/My Status.sln (rev 0) +++ trunk/plugins/My Status/My Status.sln 2007-01-31 06:18:14 UTC (rev 58) @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 9.00 +# Visual C# Express 2005 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "My Status", "My Status.csproj", "{55786500-26B8-412B-B5AB-6B965CE1218F}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {55786500-26B8-412B-B5AB-6B965CE1218F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {55786500-26B8-412B-B5AB-6B965CE1218F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {55786500-26B8-412B-B5AB-6B965CE1218F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {55786500-26B8-412B-B5AB-6B965CE1218F}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal Added: trunk/plugins/My Status/My Status.suo =================================================================== (Binary files differ) Property changes on: trunk/plugins/My Status/My Status.suo ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/My Status/Properties/AssemblyInfo.cs =================================================================== --- trunk/plugins/My Status/Properties/AssemblyInfo.cs (rev 0) +++ trunk/plugins/My Status/Properties/AssemblyInfo.cs 2007-01-31 06:18:14 UTC (rev 58) @@ -0,0 +1,35 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("GUIStatus")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("GUIStatus")] +[assembly: AssemblyCopyright("Copyright © 2006")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("0aa10a66-969d-4542-840b-7a82b7cd69ad")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] Added: trunk/plugins/My Status/SetupForm.cs =================================================================== --- trunk/plugins/My Status/SetupForm.cs (rev 0) +++ trunk/plugins/My Status/SetupForm.cs 2007-01-31 06:18:14 UTC (rev 58) @@ -0,0 +1,1533 @@ +#region Copyright (C) 2005-2006 Team MediaPortal + +/* + * Copyright (C) 2005-2006 Team MediaPortal + * http://www.team-mediaportal.com + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Make; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * http://www.gnu.org/copyleft/gpl.html + * + */ + +#endregion + +using System; +using System.Drawing; +using System.Collections; +using System.Management; +using System.ComponentModel; +using System.Windows.Forms; +using MediaPortal.GUI.Library; +using mbm5.MBMInfo; + +namespace GUIStatus +{ + /// <summary> + /// Summary description for SetupForm. + /// </summary> + public class SetupForm : System.Windows.Forms.Form, ISetupForm, IShowPlugin + { + private int[] aFan = { 0, 0, 0, 0 }; + private int[] aMhz = { 0, 0, 0, 0 }; + private int[] aPercentage = { 0, 0, 0, 0 }; + private int[] aTemperature = { 0, 0, 0, 0 }; + private int[] aVolt = { 0, 0, 0, 0, 0, 0, 0, 0 }; + private int statusVer = 1; + private bool isMbm = false; + private mbmSharedData MBMInfo = new mbmSharedData(); + private MediaPortal.UserInterface.Controls.MPLabel label1; + private MediaPortal.UserInterface.Controls.MPLabel label2; + private MediaPortal.UserInterface.Controls.MPLabel label3; + private MediaPortal.UserInterface.Controls.MPLabel label4; + private MediaPortal.UserInterface.Controls.MPLabel label5; + private MediaPortal.UserInterface.Controls.MPLabel label6; + private MediaPortal.UserInterface.Controls.MPLabel label9; + private MediaPortal.UserInterface.Controls.MPLabel label10; + private MediaPortal.UserInterface.Controls.MPLabel label11; + private MediaPortal.UserInterface.Controls.MPLabel label12; + private MediaPortal.UserInterface.Controls.MPGroupBox groupBox1; + private MediaPortal.UserInterface.Controls.MPButton button1; + private MediaPortal.UserInterface.Controls.MPCheckBox checkBox1; + private MediaPortal.UserInterface.Controls.MPCheckBox checkBox2; + private MediaPortal.UserInterface.Controls.MPCheckBox checkBox3; + private MediaPortal.UserInterface.Controls.MPLabel label7; + private MediaPortal.UserInterface.Controls.MPLabel label8; + private MediaPortal.UserInterface.Controls.MPCheckBox checkBox4; + private MediaPortal.UserInterface.Controls.MPCheckBox checkBox5; + private MediaPortal.UserInterface.Controls.MPCheckBox checkBox6; + private MediaPortal.UserInterface.Controls.MPLabel label13; + private MediaPortal.UserInterface.Controls.MPCheckBox checkBox7; + private MediaPortal.UserInterface.Controls.MPCheckBox checkBox8; + private MediaPortal.UserInterface.Controls.MPCheckBox checkBox9; + private MediaPortal.UserInterface.Controls.MPCheckBox checkBox10; + private MediaPortal.UserInterface.Controls.MPCheckBox checkBox11; + private MediaPortal.UserInterface.Controls.MPCheckBox checkBox12; + private MediaPortal.UserInterface.Controls.MPLabel label14; + private MediaPortal.UserInterface.Controls.MPCheckBox checkBox15; + private MediaPortal.UserInterface.Controls.MPLabel label15; + private MediaPortal.UserInterface.Controls.MPCheckBox checkBox13; + private MediaPortal.UserInterface.Controls.MPButton button2; + private MediaPortal.UserInterface.Controls.MPCheckBox checkBox14; + private MediaPortal.UserInterface.Controls.MPCheckBox checkBox16; + private MediaPortal.UserInterface.Controls.MPCheckBox checkBox17; + private MediaPortal.UserInterface.Controls.MPGroupBox groupBox2; + private MediaPortal.UserInterface.Controls.MPTextBox textBox1; + private MediaPortal.UserInterface.Controls.MPLabel label16; + private MediaPortal.UserInterface.Controls.MPButton button3; + private System.Windows.Forms.FolderBrowserDialog folderBrowserDialog1; + private MediaPortal.UserInterface.Controls.MPLabel label17; + private MediaPortal.UserInterface.Controls.MPTextBox textBox2; + private MediaPortal.UserInterface.Controls.MPCheckBox checkBox18; + private MediaPortal.UserInterface.Controls.MPCheckBox checkBox19; + private MediaPortal.UserInterface.Controls.MPCheckBox checkBox20; + private MediaPortal.UserInterface.Controls.MPCheckBox checkBox21; + private MediaPortal.UserInterface.Controls.MPCheckBox checkBox22; + private MediaPortal.UserInterface.Controls.MPCheckBox checkBox23; + private MediaPortal.UserInterface.Controls.MPCheckBox checkBox24; + private MediaPortal.UserInterface.Controls.MPCheckBox checkBox25; + private MediaPortal.UserInterface.Controls.MPCheckBox checkBox26; + private MediaPortal.UserInterface.Controls.MPCheckBox checkBox27; + private MediaPortal.UserInterface.Controls.MPCheckBox checkBox28; + private MediaPortal.UserInterface.Controls.MPCheckBox checkBox29; + private MediaPortal.UserInterface.Controls.MPCheckBox checkBox30; + private MediaPortal.UserInterface.Controls.MPCheckBox checkBox31; + private MediaPortal.UserInterface.Controls.MPCheckBox checkBox32; + private MediaPortal.UserInterface.Controls.MPCheckBox checkBox33; + private MediaPortal.UserInterface.Controls.MPCheckBox checkBox34; + private MediaPortal.UserInterface.Controls.MPCheckBox checkBox35; + private MediaPortal.UserInterface.Controls.MPCheckBox checkBox36; + private MediaPortal.UserInterface.Controls.MPCheckBox checkBox37; + private MediaPortal.UserInterface.Controls.MPCheckBox checkBox38; + private MediaPortal.UserInterface.Controls.MPLabel label18; + private MediaPortal.UserInterface.Controls.MPCheckBox checkBox39; + private MediaPortal.UserInterface.Controls.MPLabel label19; + private MediaPortal.UserInterface.Controls.MPCheckBox checkBox40; + private MediaPortal.UserInterface.Controls.MPCheckBox checkBox41; + private MediaPortal.UserInterface.Controls.MPLabel label20; + private MediaPortal.UserInterface.Controls.MPComboBox comboBox1; + private MediaPortal.UserInterface.Controls.MPGroupBox groupBox3; + /// <summary> + /// Required designer variable. + /// </summary> + private System.ComponentModel.Container components = null; + + public SetupForm() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + LoadSettings(); + // + // TODO... [truncated message content] |