├── ECView ├── ECView.ico ├── ecview.dll ├── dpmemio.dll ├── dpmemio.reg ├── dpmemio.sys ├── bin │ └── Release │ │ ├── ECView.exe │ │ ├── ECView.pdb │ │ ├── dpmemio.dll │ │ ├── dpmemio.reg │ │ ├── dpmemio.sys │ │ ├── ecview.dll │ │ └── ECView.exe.config ├── app.config ├── Properties │ ├── Settings.settings │ ├── Settings.Designer.cs │ ├── AssemblyInfo.cs │ ├── app.manifest │ ├── Resources.Designer.cs │ └── Resources.resx ├── App.xaml ├── ECView.csproj.user ├── Module │ ├── ModuleFactory.cs │ ├── IFanDutyModify.cs │ └── ModuleImpl │ │ └── FanDutyModifyImpl.cs ├── Pages │ ├── Binding │ │ ├── PropertyChangeBase.cs │ │ ├── ECEditorBinding.cs │ │ └── ECViewBinding.cs │ └── Windows │ │ ├── ECEditor.xaml │ │ └── ECEditor.xaml.cs ├── Tools │ ├── CallingVariation.cs │ ├── ECViewTools.cs │ └── FileAnlyze.cs ├── DataDefinitions │ ├── ConfigPara.cs │ └── IntePara.cs ├── App.xaml.cs ├── MainWindow.xaml ├── ECView.csproj └── MainWindow.xaml.cs ├── ECViewService ├── dpmemio.dll ├── ecview.dll ├── bin │ └── Release │ │ ├── ECViewService.exe │ │ └── ECViewService.pdb ├── ProjectInstaller.cs ├── Program.cs ├── Module │ ├── ModuleFactory.cs │ ├── IFanDutyModify.cs │ └── ModuleImpl │ │ └── FanDutyModifyImpl.cs ├── Tools │ ├── CallingVariation.cs │ ├── ECViewTools.cs │ └── FileAnlyze.cs ├── ECViewService.Designer.cs ├── Properties │ ├── AssemblyInfo.cs │ └── app.manifest ├── DataDefinitions │ ├── ConfigPara.cs │ └── IntePara.cs ├── ProjectInstaller.Designer.cs ├── ECViewService.cs ├── ProjectInstaller.resx └── ECViewService.csproj ├── conf_2.xml ├── conf_1.xml ├── Setup └── Setup.isproj ├── README.md ├── .gitignore └── ECView.sln /ECView/ECView.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ycraurora/Clevo-ECView/HEAD/ECView/ECView.ico -------------------------------------------------------------------------------- /ECView/ecview.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ycraurora/Clevo-ECView/HEAD/ECView/ecview.dll -------------------------------------------------------------------------------- /ECView/dpmemio.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ycraurora/Clevo-ECView/HEAD/ECView/dpmemio.dll -------------------------------------------------------------------------------- /ECView/dpmemio.reg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ycraurora/Clevo-ECView/HEAD/ECView/dpmemio.reg -------------------------------------------------------------------------------- /ECView/dpmemio.sys: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ycraurora/Clevo-ECView/HEAD/ECView/dpmemio.sys -------------------------------------------------------------------------------- /ECViewService/dpmemio.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ycraurora/Clevo-ECView/HEAD/ECViewService/dpmemio.dll -------------------------------------------------------------------------------- /ECViewService/ecview.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ycraurora/Clevo-ECView/HEAD/ECViewService/ecview.dll -------------------------------------------------------------------------------- /ECView/bin/Release/ECView.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ycraurora/Clevo-ECView/HEAD/ECView/bin/Release/ECView.exe -------------------------------------------------------------------------------- /ECView/bin/Release/ECView.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ycraurora/Clevo-ECView/HEAD/ECView/bin/Release/ECView.pdb -------------------------------------------------------------------------------- /ECView/bin/Release/dpmemio.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ycraurora/Clevo-ECView/HEAD/ECView/bin/Release/dpmemio.dll -------------------------------------------------------------------------------- /ECView/bin/Release/dpmemio.reg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ycraurora/Clevo-ECView/HEAD/ECView/bin/Release/dpmemio.reg -------------------------------------------------------------------------------- /ECView/bin/Release/dpmemio.sys: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ycraurora/Clevo-ECView/HEAD/ECView/bin/Release/dpmemio.sys -------------------------------------------------------------------------------- /ECView/bin/Release/ecview.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ycraurora/Clevo-ECView/HEAD/ECView/bin/Release/ecview.dll -------------------------------------------------------------------------------- /ECViewService/bin/Release/ECViewService.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ycraurora/Clevo-ECView/HEAD/ECViewService/bin/Release/ECViewService.exe -------------------------------------------------------------------------------- /ECViewService/bin/Release/ECViewService.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ycraurora/Clevo-ECView/HEAD/ECViewService/bin/Release/ECViewService.pdb -------------------------------------------------------------------------------- /ECView/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /ECView/bin/Release/ECView.exe.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /ECView/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /conf_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /ECView/App.xaml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ECViewService/ProjectInstaller.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | 3 | namespace ECViewService 4 | { 5 | [RunInstaller(true)] 6 | public partial class ProjectInstaller : System.Configuration.Install.Installer 7 | { 8 | public ProjectInstaller() 9 | { 10 | InitializeComponent(); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /conf_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ECViewService/Program.cs: -------------------------------------------------------------------------------- 1 | using System.ServiceProcess; 2 | 3 | namespace ECViewService 4 | { 5 | static class Program 6 | { 7 | /// 8 | /// 应用程序的主入口点。 9 | /// 10 | static void Main() 11 | { 12 | ServiceBase[] ServicesToRun; 13 | ServicesToRun = new ServiceBase[] 14 | { 15 | new ECViewService() 16 | }; 17 | ServiceBase.Run(ServicesToRun); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /ECView/ECView.csproj.user: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | publish\ 5 | 6 | 7 | 8 | 9 | 10 | en-US 11 | false 12 | 13 | -------------------------------------------------------------------------------- /ECView/Module/ModuleFactory.cs: -------------------------------------------------------------------------------- 1 | using ECView.Module.ModuleImpl; 2 | 3 | namespace ECView.Module 4 | { 5 | public class ModuleFactory 6 | { 7 | /// 8 | /// 风扇调节功能接口实例化 9 | /// 10 | private static IFanDutyModify moduleFanDutyModify = null; 11 | public static IFanDutyModify GetFanDutyModifyModule() 12 | { 13 | if (moduleFanDutyModify == null) 14 | { 15 | moduleFanDutyModify = new FanDutyModifyImpl(); 16 | } 17 | return moduleFanDutyModify; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /ECViewService/Module/ModuleFactory.cs: -------------------------------------------------------------------------------- 1 | using ECView.Module.ModuleImpl; 2 | 3 | namespace ECView.Module 4 | { 5 | public class ModuleFactory 6 | { 7 | /// 8 | /// 风扇调节功能接口实例化 9 | /// 10 | private static IFanDutyModify moduleFanDutyModify = null; 11 | public static IFanDutyModify GetFanDutyModifyModule() 12 | { 13 | if (moduleFanDutyModify == null) 14 | { 15 | moduleFanDutyModify = new FanDutyModifyImpl(); 16 | } 17 | return moduleFanDutyModify; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /ECView/Pages/Binding/PropertyChangeBase.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | 3 | namespace ECView.Pages.Binding 4 | { 5 | /// 6 | /// 属性更新基类 7 | /// 8 | public class PropertyChangeBase : INotifyPropertyChanged 9 | { 10 | /// 11 | /// 属性更新委托 12 | /// 13 | public event PropertyChangedEventHandler PropertyChanged; 14 | /// 15 | /// 数据更新 16 | /// 17 | /// 18 | public void Notify(string propertyName) 19 | { 20 | if (PropertyChanged != null) 21 | { 22 | PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /ECView/Tools/CallingVariation.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | 3 | namespace ECView.Tools 4 | { 5 | public class CallingVariation 6 | { 7 | [DllImport("ecview.dll", EntryPoint = "#3")] 8 | public static extern void SetFanDuty(int p1, int p2); 9 | 10 | [DllImport("ecview.dll", EntryPoint = "#4")] 11 | public static extern int SetFANDutyAuto(int p1); 12 | 13 | [DllImport("ecview.dll", EntryPoint = "#5")] 14 | public static extern ECData GetTempFanDuty(int p1); 15 | 16 | [DllImport("ecview.dll", EntryPoint = "#6")] 17 | public static extern int GetFANCounter(); 18 | 19 | [DllImport("ecview.dll", EntryPoint = "#8")] 20 | public static extern string GetECVersion(); 21 | 22 | public struct ECData 23 | { 24 | public int data; 25 | public int data1; 26 | public int data2; 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /ECViewService/Tools/CallingVariation.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | 3 | namespace ECView.Tools 4 | { 5 | public class CallingVariation 6 | { 7 | [DllImport("ecview.dll", EntryPoint = "#3")] 8 | public static extern void SetFanDuty(int p1, int p2); 9 | 10 | [DllImport("ecview.dll", EntryPoint = "#4")] 11 | public static extern int SetFANDutyAuto(int p1); 12 | 13 | [DllImport("ecview.dll", EntryPoint = "#5")] 14 | public static extern ECData GetTempFanDuty(int p1); 15 | 16 | [DllImport("ecview.dll", EntryPoint = "#6")] 17 | public static extern int GetFANCounter(); 18 | 19 | [DllImport("ecview.dll", EntryPoint = "#8")] 20 | public static extern string GetECVersion(); 21 | 22 | public struct ECData 23 | { 24 | public int data; 25 | public int data1; 26 | public int data2; 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /ECViewService/ECViewService.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace ECViewService 2 | { 3 | partial class ECViewService 4 | { 5 | /// 6 | /// 必需的设计器变量。 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// 清理所有正在使用的资源。 12 | /// 13 | /// 如果应释放托管资源,为 true;否则为 false。 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region 组件设计器生成的代码 24 | 25 | /// 26 | /// 设计器支持所需的方法 - 不要修改 27 | /// 使用代码编辑器修改此方法的内容。 28 | /// 29 | private void InitializeComponent() 30 | { 31 | components = new System.ComponentModel.Container(); 32 | this.ServiceName = "Service1"; 33 | } 34 | 35 | #endregion 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /ECViewService/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // 有关程序集的一般信息由以下 5 | // 控制。更改这些特性值可修改 6 | // 与程序集关联的信息。 7 | [assembly: AssemblyTitle("ECViewService")] 8 | [assembly: AssemblyDescription("YcraD")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("HIT_DDS")] 11 | [assembly: AssemblyProduct("ECViewService")] 12 | [assembly: AssemblyCopyright("Copyright © DDS 2015")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | //将 ComVisible 设置为 false 将使此程序集中的类型 17 | //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 18 | //请将此类型的 ComVisible 特性设置为 true。 19 | [assembly: ComVisible(true)] 20 | 21 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 22 | [assembly: Guid("b0300d4f-247d-4cea-adbc-f0d0809c8764")] 23 | 24 | // 程序集的版本信息由下列四个值组成: 25 | // 26 | // 主版本 27 | // 次版本 28 | // 生成号 29 | // 修订号 30 | // 31 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 32 | // 方法是按如下所示使用“*”: : 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.1.0.0")] 35 | [assembly: AssemblyFileVersion("1.1.0.0")] 36 | -------------------------------------------------------------------------------- /ECView/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // 此代码由工具生成。 4 | // 运行时版本:4.0.30319.42000 5 | // 6 | // 对此文件的更改可能会导致不正确的行为,并且如果 7 | // 重新生成代码,这些更改将会丢失。 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace ECView.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /ECView/DataDefinitions/ConfigPara.cs: -------------------------------------------------------------------------------- 1 | namespace ECView.DataDefinitions 2 | { 3 | public class ConfigPara 4 | { 5 | /// 6 | /// 主板型号 7 | /// 8 | public string NbModel 9 | { 10 | get; 11 | set; 12 | } 13 | /// 14 | /// EC版本 15 | /// 16 | public string ECVersion 17 | { 18 | get; 19 | set; 20 | } 21 | /// 22 | /// 调节模式号 23 | /// 24 | public int SetMode 25 | { 26 | get; 27 | set; 28 | } 29 | /// 30 | /// 风扇号 31 | /// 32 | public int FanNo 33 | { 34 | get; 35 | set; 36 | } 37 | /// 38 | /// 调节模式 39 | /// 40 | public string FanSet 41 | { 42 | get; 43 | set; 44 | } 45 | /// 46 | /// 风扇转速 47 | /// 48 | public int FanDuty 49 | { 50 | get; 51 | set; 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /ECViewService/DataDefinitions/ConfigPara.cs: -------------------------------------------------------------------------------- 1 | namespace ECView.DataDefinitions 2 | { 3 | public class ConfigPara 4 | { 5 | /// 6 | /// 主板型号 7 | /// 8 | public string NbModel 9 | { 10 | get; 11 | set; 12 | } 13 | /// 14 | /// EC版本 15 | /// 16 | public string ECVersion 17 | { 18 | get; 19 | set; 20 | } 21 | /// 22 | /// 调节模式号 23 | /// 24 | public int SetMode 25 | { 26 | get; 27 | set; 28 | } 29 | /// 30 | /// 风扇号 31 | /// 32 | public int FanNo 33 | { 34 | get; 35 | set; 36 | } 37 | /// 38 | /// 调节模式 39 | /// 40 | public string FanSet 41 | { 42 | get; 43 | set; 44 | } 45 | /// 46 | /// 风扇转速 47 | /// 48 | public int FanDuty 49 | { 50 | get; 51 | set; 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /ECView/Pages/Binding/ECEditorBinding.cs: -------------------------------------------------------------------------------- 1 | namespace ECView.Pages.Binding 2 | { 3 | public class ECEditorBinding : PropertyChangeBase 4 | { 5 | /// 6 | /// 风扇号 7 | /// 8 | private string _fanNo; 9 | public string FanNo 10 | { 11 | set 12 | { 13 | _fanNo = value; 14 | Notify("FanNo"); 15 | } 16 | get 17 | { 18 | return _fanNo; 19 | } 20 | } 21 | /// 22 | /// 风扇转速 23 | /// 24 | private int _fanDuty; 25 | public int FanDuty 26 | { 27 | set 28 | { 29 | _fanDuty = value; 30 | Notify("FanDuty"); 31 | } 32 | get 33 | { 34 | return _fanDuty; 35 | } 36 | } 37 | /// 38 | /// 配置文件路径 39 | /// 40 | private string _filePath; 41 | public string FilePath 42 | { 43 | set 44 | { 45 | _filePath = value; 46 | Notify("FilePath"); 47 | } 48 | get 49 | { 50 | return _filePath; 51 | } 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /ECView/DataDefinitions/IntePara.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace ECView.DataDefinitions 4 | { 5 | public class IntePara 6 | { 7 | /// 8 | /// 风扇号 9 | /// 10 | public int FanNo 11 | { 12 | get; 13 | set; 14 | } 15 | /// 16 | /// 智能控速模式号 17 | /// 18 | public int ControlType 19 | { 20 | get; 21 | set; 22 | } 23 | /// 24 | /// 最小转速 25 | /// 26 | public int MinFanDuty 27 | { 28 | get; 29 | set; 30 | } 31 | /// 32 | /// 范围参数列表 33 | /// 34 | public List RangeParaList 35 | { 36 | get; 37 | set; 38 | } 39 | } 40 | 41 | public class RangePara 42 | { 43 | /// 44 | /// 范围号 45 | /// 46 | public int RangeNo 47 | { 48 | get; 49 | set; 50 | } 51 | /// 52 | /// 转速 53 | /// 54 | public int FanDuty 55 | { 56 | get; 57 | set; 58 | } 59 | /// 60 | /// 温度基础上增加百分比 61 | /// 62 | public int AddPercentage 63 | { 64 | get; 65 | set; 66 | } 67 | /// 68 | /// 范围下限 69 | /// 70 | public int InferiorLimit 71 | { 72 | get; 73 | set; 74 | } 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /ECViewService/DataDefinitions/IntePara.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace ECView.DataDefinitions 4 | { 5 | public class IntePara 6 | { 7 | /// 8 | /// 风扇号 9 | /// 10 | public int FanNo 11 | { 12 | get; 13 | set; 14 | } 15 | /// 16 | /// 智能控速模式号 17 | /// 18 | public int ControlType 19 | { 20 | get; 21 | set; 22 | } 23 | /// 24 | /// 最小转速 25 | /// 26 | public int MinFanDuty 27 | { 28 | get; 29 | set; 30 | } 31 | /// 32 | /// 范围参数列表 33 | /// 34 | public List RangeParaList 35 | { 36 | get; 37 | set; 38 | } 39 | } 40 | 41 | public class RangePara 42 | { 43 | /// 44 | /// 范围号 45 | /// 46 | public int RangeNo 47 | { 48 | get; 49 | set; 50 | } 51 | /// 52 | /// 转速 53 | /// 54 | public int FanDuty 55 | { 56 | get; 57 | set; 58 | } 59 | /// 60 | /// 温度基础上增加百分比 61 | /// 62 | public int AddPercentage 63 | { 64 | get; 65 | set; 66 | } 67 | /// 68 | /// 范围下限 69 | /// 70 | public int InferiorLimit 71 | { 72 | get; 73 | set; 74 | } 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /ECView/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics; 2 | using System.Threading; 3 | using System.Windows; 4 | 5 | namespace ECView 6 | { 7 | /// 8 | /// Interaction logic for App.xaml 9 | /// 10 | public partial class App : Application 11 | { 12 | Mutex mut; 13 | public App() 14 | { 15 | //禁用重复开启 16 | /*bool createNew = false; 17 | string targetExeName = System.Reflection.Assembly.GetExecutingAssembly().Location; 18 | string productName = System.IO.Path.GetFileName(System.Reflection.Assembly.GetEntryAssembly().GetName().Name); 19 | 20 | using (System.Threading.Mutex mutex = new System.Threading.Mutex(true, productName, out createNew)) 21 | { 22 | if (createNew) 23 | { 24 | StartupUri = new Uri("MainWindow.xaml", UriKind.Relative); 25 | Run(); 26 | } 27 | else 28 | { 29 | //PTMCWin32API.SendMessage(targetExeName, "Protocol Testing Management Console", "/v:true"); 30 | Environment.Exit(1); 31 | } 32 | }*/ 33 | bool requestInitialOwnership = true; 34 | bool mutexWasCreated; 35 | mut = new Mutex(requestInitialOwnership, "com.ECView.Ding", out mutexWasCreated); 36 | if (!(requestInitialOwnership && mutexWasCreated)) 37 | { 38 | // 随意什么操作啦~ 39 | //Current.Shutdown(); 40 | //当前运行WPF程序的进程实例 41 | Process process = Process.GetCurrentProcess(); 42 | process.Kill(); 43 | } 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /Setup/Setup.isproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Express 6 | 7 | Debug 8 | $(Configuration) 9 | 10 | 11 | 12 | 13 | 14 | 15 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 29 | 30 | 31 | 32 | 33 | ECView 34 | {66A0097B-7BAB-428C-BCF0-31977BAE8375} 35 | 36 | 37 | ECViewService 38 | {B0300D4F-247D-4CEA-ADBC-F0D0809C8764} 39 | 40 | 41 | -------------------------------------------------------------------------------- /ECViewService/ProjectInstaller.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace ECViewService 2 | { 3 | partial class ProjectInstaller 4 | { 5 | /// 6 | /// 必需的设计器变量。 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// 清理所有正在使用的资源。 12 | /// 13 | /// 如果应释放托管资源,为 true;否则为 false。 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region 组件设计器生成的代码 24 | 25 | /// 26 | /// 设计器支持所需的方法 - 不要修改 27 | /// 使用代码编辑器修改此方法的内容。 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.serviceProcessInstaller1 = new System.ServiceProcess.ServiceProcessInstaller(); 32 | this.serviceInstaller1 = new System.ServiceProcess.ServiceInstaller(); 33 | // 34 | // serviceProcessInstaller1 35 | // 36 | this.serviceProcessInstaller1.Account = System.ServiceProcess.ServiceAccount.LocalSystem; 37 | this.serviceProcessInstaller1.Password = null; 38 | this.serviceProcessInstaller1.Username = null; 39 | // 40 | // serviceInstaller1 41 | // 42 | this.serviceInstaller1.Description = "ECView服务"; 43 | this.serviceInstaller1.DisplayName = "ECViewService"; 44 | this.serviceInstaller1.ServiceName = "Service1"; 45 | // 46 | // ProjectInstaller 47 | // 48 | this.Installers.AddRange(new System.Configuration.Install.Installer[] { 49 | this.serviceProcessInstaller1, 50 | this.serviceInstaller1}); 51 | 52 | } 53 | 54 | #endregion 55 | 56 | private System.ServiceProcess.ServiceProcessInstaller serviceProcessInstaller1; 57 | private System.ServiceProcess.ServiceInstaller serviceInstaller1; 58 | } 59 | } -------------------------------------------------------------------------------- /ECView/Module/IFanDutyModify.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using ECView.DataDefinitions; 3 | 4 | namespace ECView.Module 5 | { 6 | public interface IFanDutyModify 7 | { 8 | /// 9 | /// 设置风扇转速 10 | /// 11 | /// 风扇号 12 | /// 风扇转速 13 | /// 自动调节标识 14 | /// 风扇实际转速 15 | int[] SetFanduty(int fanNo, int fanduty, bool isAuto); 16 | /// 17 | /// 获取EC版本号 18 | /// 19 | /// EC版本 20 | string GetECVersion(); 21 | /// 22 | /// 获取风扇转速与温度数据 23 | /// 24 | /// 风扇号 25 | /// 转速与温度结构体 26 | int[] GetTempFanDuty(int fanNo); 27 | /// 28 | /// 获取风扇数量 29 | /// 30 | /// 风扇数量 31 | int GetFanCount(); 32 | /// 33 | /// 检测服务是否启动 34 | /// 35 | /// 服务名称 36 | /// 服务状态 37 | int CheckServiceState(string serviceName); 38 | /// 39 | /// 启动服务 40 | /// 41 | /// 服务名称 42 | /// 启动状态 43 | bool StartService(string serviceName); 44 | /// 45 | /// 停止服务 46 | /// 47 | /// 服务名称 48 | /// 49 | bool StopService(string serviceName); 50 | /// 51 | /// 写入配置文件 52 | /// 53 | /// 配置文件名 54 | /// 风扇配置 55 | void WriteCfgFile(string filename, List configParaList); 56 | /// 57 | /// 读取配置文件 58 | /// 59 | /// 配置文件名 60 | /// 风扇配置 61 | List ReadCfgFile(string filename); 62 | /// 63 | /// 智能调节风扇转速 64 | /// 65 | /// 配置文件路径 66 | /// 风扇号 67 | /// 68 | bool InteFandutyControl(string filePath, int fanNo); 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /ECViewService/Module/IFanDutyModify.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using ECView.DataDefinitions; 3 | 4 | namespace ECView.Module 5 | { 6 | public interface IFanDutyModify 7 | { 8 | /// 9 | /// 设置风扇转速 10 | /// 11 | /// 风扇号 12 | /// 风扇转速 13 | /// 自动调节标识 14 | /// 风扇实际转速 15 | int[] SetFanduty(int fanNo, int fanduty, bool isAuto); 16 | /// 17 | /// 获取EC版本号 18 | /// 19 | /// EC版本 20 | string GetECVersion(); 21 | /// 22 | /// 获取风扇转速与温度数据 23 | /// 24 | /// 风扇号 25 | /// 转速与温度结构体 26 | int[] GetTempFanDuty(int fanNo); 27 | /// 28 | /// 获取风扇数量 29 | /// 30 | /// 风扇数量 31 | int GetFanCount(); 32 | /// 33 | /// 检测服务是否启动 34 | /// 35 | /// 服务名称 36 | /// 服务状态 37 | int CheckServiceState(string serviceName); 38 | /// 39 | /// 启动服务 40 | /// 41 | /// 服务名称 42 | /// 启动状态 43 | bool StartService(string serviceName); 44 | /// 45 | /// 停止服务 46 | /// 47 | /// 服务名称 48 | /// 49 | bool StopService(string serviceName); 50 | /// 51 | /// 写入配置文件 52 | /// 53 | /// 配置文件名 54 | /// 风扇配置 55 | void WriteCfgFile(string filename, List configParaList); 56 | /// 57 | /// 读取配置文件 58 | /// 59 | /// 配置文件名 60 | /// 风扇配置 61 | List ReadCfgFile(string filename); 62 | /// 63 | /// 智能调节风扇转速 64 | /// 65 | /// 配置文件路径 66 | /// 风扇号 67 | /// 68 | bool InteFandutyControl(string filePath, int fanNo); 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /ECView/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | using System.Windows; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("ECView")] 9 | [assembly: AssemblyDescription("YcraD")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("HIT_DDS")] 12 | [assembly: AssemblyProduct("ECView")] 13 | [assembly: AssemblyCopyright("Copyright © DDS 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(true)] 21 | 22 | //In order to begin building localizable applications, set 23 | //CultureYouAreCodingWith in your .csproj file 24 | //inside a . For example, if you are using US english 25 | //in your source files, set the to en-US. Then uncomment 26 | //the NeutralResourceLanguage attribute below. Update the "en-US" in 27 | //the line below to match the UICulture setting in the project file. 28 | 29 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] 30 | 31 | 32 | [assembly: ThemeInfo( 33 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located 34 | //(used if a resource is not found in the page, 35 | // or application resource dictionaries) 36 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located 37 | //(used if a resource is not found in the page, 38 | // app, or any theme specific resource dictionaries) 39 | )] 40 | 41 | 42 | // Version information for an assembly consists of the following four values: 43 | // 44 | // Major Version 45 | // Minor Version 46 | // Build Number 47 | // Revision 48 | // 49 | // You can specify all the values or you can default the Build and Revision Numbers 50 | // by using the '*' as shown below: 51 | // [assembly: AssemblyVersion("1.0.*")] 52 | [assembly: AssemblyVersion("1.1.0.0")] 53 | [assembly: AssemblyFileVersion("1.1.0.0")] 54 | -------------------------------------------------------------------------------- /ECViewService/ECViewService.cs: -------------------------------------------------------------------------------- 1 | using ECView.DataDefinitions; 2 | using ECView.Module; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.ServiceProcess; 6 | using System.Threading; 7 | 8 | namespace ECViewService 9 | { 10 | public partial class ECViewService : ServiceBase 11 | { 12 | //当前路径 13 | private string currentDirectory = AppDomain.CurrentDomain.SetupInformation.ApplicationBase; 14 | //功能接口 15 | private IFanDutyModify iFanDutyModify; 16 | //线程 17 | private Thread t = null; 18 | List configParaList = null; 19 | /// 20 | /// 初始化服务 21 | /// 22 | public ECViewService() 23 | { 24 | InitializeComponent(); 25 | iFanDutyModify = ModuleFactory.GetFanDutyModifyModule(); 26 | } 27 | /// 28 | /// 循环处理事件 29 | /// 30 | private void setFandutyThread() 31 | { 32 | //判断配置文件是否存在 33 | if (System.IO.File.Exists(currentDirectory + "ecview.cfg")) 34 | { 35 | while (true) 36 | { 37 | //线程暂停10s 38 | Thread.Sleep(10 * 1000); 39 | foreach (ConfigPara configPara in configParaList) 40 | { 41 | if (configPara.SetMode == 1) 42 | { 43 | //若配置为自动调节,设置风扇自动调节 44 | iFanDutyModify.SetFanduty(configPara.FanNo, 0, true); 45 | } 46 | else if (configPara.SetMode == 2) 47 | { 48 | //若配置为手动调节,设置风扇转速 49 | iFanDutyModify.SetFanduty(configPara.FanNo, (int)(configPara.FanDuty * 2.55m), false); 50 | } 51 | else if (configPara.SetMode == 3) 52 | { 53 | //若配置为智能调节,设置风扇转速 54 | iFanDutyModify.InteFandutyControl(currentDirectory + "conf\\Configuration_" + configPara.FanNo + ".xml", configPara.FanNo); 55 | } 56 | } 57 | } 58 | } 59 | } 60 | /// 61 | /// 服务启动动作 62 | /// 63 | /// 64 | protected override void OnStart(string[] args) 65 | { 66 | configParaList = iFanDutyModify.ReadCfgFile(currentDirectory + "ecview.cfg"); 67 | t = new Thread(new ThreadStart(setFandutyThread)); 68 | //设置线程优先级最低 69 | t.Priority = ThreadPriority.Lowest; 70 | t.Start(); 71 | } 72 | /// 73 | /// 服务关闭动作 74 | /// 75 | protected override void OnStop() 76 | { 77 | //停止线程 78 | t.Abort(); 79 | } 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /ECView/Properties/app.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 47 | 54 | 55 | 69 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Clevo-ECView 2 | ============ 3 |
4 | Clevo ECviewer and FanDuty Controller
5 |
6 | Visual Studio 2010
7 | Visual Studio 2013
8 | Visual Studio 2015
9 |
10 | Visual C# WPF & Setup Project InstallShield LE Setup Project
11 |
12 | NOTICE: This project is in Chinese(Simplified)
13 | ==================================================================
14 |
15 | Update NOTE:
16 | 2015.12.17 Thur.
17 |
18 | 1.Click once only method fixed
19 | 2.A few UI improvements
20 | 3.A few code optimization,including rewrite the inteControl method
21 | 4.Other fixes
22 | ==================================================================
23 |
24 | Update NOTE:
25 | 2015.12.09 Tue.
26 |
27 | 1.Set click once only
28 | ==================================================================
29 |
30 | Update NOTE:
31 | 2015.12.05 Sat.
32 |
33 | 1.Adaptation for windows 10
34 | ==================================================================
35 |
36 | Release NOTE:
37 | 2014.12.10 Wed.
38 |
39 | 1.Update project to VS2013
40 | 2.Rewrite methods in DLL
41 | 3.Rewrite loop in Windows Service
42 | 4.Remove autorun & backrun and use Windows Service instead
43 | 5.Now you can add & remove fans(support multifans' control)
44 | 6.Other features see the history release(s)
45 | ==================================================================
46 |
47 | Update NOTE(WIP):
48 | 2014.12.04 Tur.
49 |
50 | 1.Update project to VS2012
51 | 2.Delete original Visual Studio Setup Project
52 | 3.Add InstallShield LE Setup Project
53 | ==================================================================
54 |
55 | Release NOTE:
56 | 2014.11.30 Sun.
57 |
58 | 1.Enable/disable autorun/backrun in Settings
59 | 2.Show EC version and baseboard model in main window
60 | 3.Show CPU Remote/Local temperatures in main window
61 | 4.List all detected fans in main window
62 | 5.Set fan duty in fan setting window
63 | 6.Auto control mode(bios default)
64 | 7.Manuel control mode to set fan duty percentage
65 | 8.Intellectual control mode to set fan duty by loading config files
66 |
67 | Intellectual control mode 1:
68 | conf_1.xml
69 | This is the example config file for Intellectual control mode 1.You can
70 | set fan duty percentage with different ranges.
71 |
72 | Intellectual control mode 2:
73 | conf_2.xml
74 | This is the example config file for Intellectual control mode 2.You can
75 | set fan duty percentage added by the CPU temperature(℃) with different
76 | ranges.
77 |
78 | Author: ycrad
79 | E-mail: just4steven@163.com/just4steven@gmail.com -------------------------------------------------------------------------------- /ECView/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // 此代码由工具生成。 4 | // 运行时版本:4.0.30319.42000 5 | // 6 | // 对此文件的更改可能会导致不正确的行为,并且如果 7 | // 重新生成代码,这些更改将会丢失。 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace ECView.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// 一个强类型的资源类,用于查找本地化的字符串等。 17 | /// 18 | // 此类是由 StronglyTypedResourceBuilder 19 | // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 20 | // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen 21 | // (以 /str 作为命令选项),或重新生成 VS 项目。 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// 返回此类使用的缓存的 ResourceManager 实例。 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ECView.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// 使用此强类型资源类,为所有资源查找 51 | /// 重写当前线程的 CurrentUICulture 属性。 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | 63 | /// 64 | /// 查找类似于 (Icon) 的 System.Drawing.Icon 类型的本地化资源。 65 | /// 66 | internal static System.Drawing.Icon ECView { 67 | get { 68 | object obj = ResourceManager.GetObject("ECView", resourceCulture); 69 | return ((System.Drawing.Icon)(obj)); 70 | } 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /ECViewService/Properties/app.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 47 | 54 | 55 | 69 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.sln.docstates 8 | 9 | # Build results 10 | [Dd]ebug/ 11 | [Dd]ebugPublic/ 12 | [Rr]elease/ 13 | [Rr]eleases/ 14 | x64/ 15 | x86/ 16 | build/ 17 | bld/ 18 | [Bb]in/ 19 | [Oo]bj/ 20 | 21 | # Roslyn cache directories 22 | *.ide/ 23 | 24 | # MSTest test Results 25 | [Tt]est[Rr]esult*/ 26 | [Bb]uild[Ll]og.* 27 | 28 | #NUNIT 29 | *.VisualState.xml 30 | TestResult.xml 31 | 32 | # Build Results of an ATL Project 33 | [Dd]ebugPS/ 34 | [Rr]eleasePS/ 35 | dlldata.c 36 | 37 | *_i.c 38 | *_p.c 39 | *_i.h 40 | *.ilk 41 | *.meta 42 | *.obj 43 | *.pch 44 | *.pdb 45 | *.pgc 46 | *.pgd 47 | *.rsp 48 | *.sbr 49 | *.tlb 50 | *.tli 51 | *.tlh 52 | *.tmp 53 | *.tmp_proj 54 | *.log 55 | *.vspscc 56 | *.vssscc 57 | .builds 58 | *.pidb 59 | *.svclog 60 | *.scc 61 | 62 | # Chutzpah Test files 63 | _Chutzpah* 64 | 65 | # Visual C++ cache files 66 | ipch/ 67 | *.aps 68 | *.ncb 69 | *.opensdf 70 | *.sdf 71 | *.cachefile 72 | 73 | # Visual Studio profiler 74 | *.psess 75 | *.vsp 76 | *.vspx 77 | 78 | # TFS 2012 Local Workspace 79 | $tf/ 80 | 81 | # Guidance Automation Toolkit 82 | *.gpState 83 | 84 | # ReSharper is a .NET coding add-in 85 | _ReSharper*/ 86 | *.[Rr]e[Ss]harper 87 | *.DotSettings.user 88 | 89 | # JustCode is a .NET coding addin-in 90 | .JustCode 91 | 92 | # TeamCity is a build add-in 93 | _TeamCity* 94 | 95 | # DotCover is a Code Coverage Tool 96 | *.dotCover 97 | 98 | # NCrunch 99 | _NCrunch_* 100 | .*crunch*.local.xml 101 | 102 | # MightyMoose 103 | *.mm.* 104 | AutoTest.Net/ 105 | 106 | # Web workbench (sass) 107 | .sass-cache/ 108 | 109 | # Installshield output folder 110 | [Ee]xpress/ 111 | 112 | # DocProject is a documentation generator add-in 113 | DocProject/buildhelp/ 114 | DocProject/Help/*.HxT 115 | DocProject/Help/*.HxC 116 | DocProject/Help/*.hhc 117 | DocProject/Help/*.hhk 118 | DocProject/Help/*.hhp 119 | DocProject/Help/Html2 120 | DocProject/Help/html 121 | 122 | # Click-Once directory 123 | publish/ 124 | 125 | # Publish Web Output 126 | *.[Pp]ublish.xml 127 | *.azurePubxml 128 | # TODO: Comment the next line if you want to checkin your web deploy settings 129 | # but database connection strings (with potential passwords) will be unencrypted 130 | *.pubxml 131 | *.publishproj 132 | 133 | # NuGet Packages 134 | *.nupkg 135 | # The packages folder can be ignored because of Package Restore 136 | **/packages/* 137 | # except build/, which is used as an MSBuild target. 138 | !**/packages/build/ 139 | # If using the old MSBuild-Integrated Package Restore, uncomment this: 140 | #!**/packages/repositories.config 141 | 142 | # Windows Azure Build Output 143 | csx/ 144 | *.build.csdef 145 | 146 | # Windows Store app package directory 147 | AppPackages/ 148 | 149 | # Others 150 | sql/ 151 | *.Cache 152 | ClientBin/ 153 | [Ss]tyle[Cc]op.* 154 | ~$* 155 | *~ 156 | *.dbmdl 157 | *.dbproj.schemaview 158 | *.pfx 159 | *.publishsettings 160 | node_modules/ 161 | 162 | # RIA/Silverlight projects 163 | Generated_Code/ 164 | 165 | # Backup & report files from converting an old project file 166 | # to a newer Visual Studio version. Backup files are not needed, 167 | # because we have git ;-) 168 | _UpgradeReport_Files/ 169 | Backup*/ 170 | UpgradeLog*.XML 171 | UpgradeLog*.htm 172 | 173 | # SQL Server files 174 | *.mdf 175 | *.ldf 176 | 177 | # Business Intelligence projects 178 | *.rdl.data 179 | *.bim.layout 180 | *.bim_*.settings 181 | 182 | # Microsoft Fakes 183 | FakesAssemblies/ 184 | /*.suo 185 | /*.suo 186 | -------------------------------------------------------------------------------- /ECView/Tools/ECViewTools.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ServiceProcess; 3 | 4 | namespace ECView.Tools 5 | { 6 | public class ECViewTools 7 | { 8 | /// 9 | 10 | public static int CheckServiceState(string serviceName) 11 | { 12 | ServiceController[] service = ServiceController.GetServices(); 13 | bool isStart = false; 14 | bool isExite = false; 15 | for (int i = 0; i < service.Length; i++) 16 | { 17 | if (service[i].ServiceName.ToUpper().Equals(serviceName.ToUpper())) 18 | { 19 | isExite = true; 20 | ServiceController server = service[i]; 21 | if (service[i].Status == ServiceControllerStatus.Running) 22 | { 23 | isStart = true; 24 | break; 25 | } 26 | } 27 | } 28 | 29 | if (!isExite) 30 | { 31 | //服务不存在 32 | return 0; 33 | }else{ 34 | if (isStart) 35 | { 36 | //服务存在并启动 37 | return 1; 38 | } 39 | else 40 | { 41 | //服务存在但未启动 42 | return 2; 43 | } 44 | } 45 | } 46 | /// 47 | /// 启动服务 48 | /// 49 | /// 50 | /// 51 | public static bool StartService(string serviceName) 52 | { 53 | try 54 | { 55 | ServiceController service = new ServiceController(serviceName); 56 | if (service.Status == ServiceControllerStatus.Running) 57 | { 58 | //服务已启动 59 | return true; 60 | } 61 | else 62 | { 63 | //服务未启动 64 | //设置timeout 65 | TimeSpan timeout = TimeSpan.FromMilliseconds(1000 * 10); 66 | service.Start();//启动程序 67 | service.WaitForStatus(ServiceControllerStatus.Running, timeout); 68 | return true; 69 | } 70 | } 71 | catch (Exception e) 72 | { 73 | Console.WriteLine("启动服务错误,原因:" + e.Message); 74 | return false; 75 | } 76 | } 77 | /// 78 | /// 停止服务 79 | /// 80 | /// 81 | /// 82 | public static bool StopService(string serviceName) 83 | { 84 | try 85 | { 86 | ServiceController service = new ServiceController(serviceName); 87 | if (service.Status == ServiceControllerStatus.Stopped) 88 | { 89 | //服务已停止 90 | return true; 91 | } 92 | else 93 | { 94 | //服务未停止 95 | //设置timeout 96 | TimeSpan timeout = TimeSpan.FromMilliseconds(1000 * 10); 97 | service.Stop();//停止程序 98 | service.WaitForStatus(ServiceControllerStatus.Stopped, timeout); 99 | return true; 100 | } 101 | } 102 | catch (Exception e) 103 | { 104 | Console.WriteLine("停止服务错误,原因:" + e.Message); 105 | return false; 106 | } 107 | } 108 | /// 109 | /// 检测XML文件 110 | /// 111 | /// 文件路径 112 | /// 113 | public static bool CheckXmlFile(string filePath) 114 | { 115 | return false; 116 | } 117 | } 118 | } 119 | -------------------------------------------------------------------------------- /ECViewService/Tools/ECViewTools.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ServiceProcess; 3 | 4 | namespace ECView.Tools 5 | { 6 | public class ECViewTools 7 | { 8 | /// 9 | 10 | public static int CheckServiceState(string serviceName) 11 | { 12 | ServiceController[] service = ServiceController.GetServices(); 13 | bool isStart = false; 14 | bool isExite = false; 15 | for (int i = 0; i < service.Length; i++) 16 | { 17 | if (service[i].ServiceName.ToUpper().Equals(serviceName.ToUpper())) 18 | { 19 | isExite = true; 20 | ServiceController server = service[i]; 21 | if (service[i].Status == ServiceControllerStatus.Running) 22 | { 23 | isStart = true; 24 | break; 25 | } 26 | } 27 | } 28 | 29 | if (!isExite) 30 | { 31 | //服务不存在 32 | return 0; 33 | }else{ 34 | if (isStart) 35 | { 36 | //服务存在并启动 37 | return 1; 38 | } 39 | else 40 | { 41 | //服务存在但未启动 42 | return 2; 43 | } 44 | } 45 | } 46 | /// 47 | /// 启动服务 48 | /// 49 | /// 50 | /// 51 | public static bool StartService(string serviceName) 52 | { 53 | try 54 | { 55 | ServiceController service = new ServiceController(serviceName); 56 | if (service.Status == ServiceControllerStatus.Running) 57 | { 58 | //服务已启动 59 | return true; 60 | } 61 | else 62 | { 63 | //服务未启动 64 | //设置timeout 65 | TimeSpan timeout = TimeSpan.FromMilliseconds(1000 * 10); 66 | service.Start();//启动程序 67 | service.WaitForStatus(ServiceControllerStatus.Running, timeout); 68 | return true; 69 | } 70 | } 71 | catch (Exception e) 72 | { 73 | Console.WriteLine("启动服务错误,原因:" + e.Message); 74 | return false; 75 | } 76 | } 77 | /// 78 | /// 停止服务 79 | /// 80 | /// 81 | /// 82 | public static bool StopService(string serviceName) 83 | { 84 | try 85 | { 86 | ServiceController service = new ServiceController(serviceName); 87 | if (service.Status == ServiceControllerStatus.Stopped) 88 | { 89 | //服务已停止 90 | return true; 91 | } 92 | else 93 | { 94 | //服务未停止 95 | //设置timeout 96 | TimeSpan timeout = TimeSpan.FromMilliseconds(1000 * 10); 97 | service.Stop();//停止程序 98 | service.WaitForStatus(ServiceControllerStatus.Stopped, timeout); 99 | return true; 100 | } 101 | } 102 | catch (Exception e) 103 | { 104 | Console.WriteLine("停止服务错误,原因:" + e.Message); 105 | return false; 106 | } 107 | } 108 | /// 109 | /// 检测XML文件 110 | /// 111 | /// 文件路径 112 | /// 113 | public static bool CheckXmlFile(string filePath) 114 | { 115 | return false; 116 | } 117 | } 118 | } 119 | -------------------------------------------------------------------------------- /ECView/Pages/Binding/ECViewBinding.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.ObjectModel; 2 | 3 | namespace ECView.Pages.Binding 4 | { 5 | public class ECViewCollec : ObservableCollection 6 | { 7 | /// 8 | /// EC参数与DataGrid绑定 9 | /// 10 | public ECViewCollec() 11 | { 12 | ; 13 | } 14 | } 15 | 16 | public class ECViewBinding : PropertyChangeBase 17 | { 18 | /// 19 | /// 模具型号 20 | /// 21 | private string _nbModel; 22 | public string NbModel 23 | { 24 | set 25 | { 26 | _nbModel = value; 27 | Notify("NbModel"); 28 | } 29 | get 30 | { 31 | return _nbModel; 32 | } 33 | } 34 | /// 35 | /// EC版本 36 | /// 37 | private string _ecversion; 38 | public string ECVersion 39 | { 40 | set 41 | { 42 | _ecversion = value; 43 | Notify("ECVersion"); 44 | } 45 | get 46 | { 47 | return _ecversion; 48 | } 49 | } 50 | /// 51 | /// 风扇号 52 | /// 53 | private int _fanNo; 54 | public int FanNo 55 | { 56 | set 57 | { 58 | _fanNo = value; 59 | Notify("FanNo"); 60 | } 61 | get 62 | { 63 | return _fanNo; 64 | } 65 | } 66 | /// 67 | /// 风扇转速 68 | /// 69 | private string _fandutyStr; 70 | public string FanDutyStr 71 | { 72 | set 73 | { 74 | _fandutyStr = value; 75 | Notify("FanDutyStr"); 76 | } 77 | get 78 | { 79 | return _fandutyStr; 80 | } 81 | } 82 | /// 83 | /// 风扇转速 84 | /// 85 | private int _fanduty; 86 | public int FanDuty 87 | { 88 | set 89 | { 90 | _fanduty = value; 91 | Notify("FanDuty"); 92 | } 93 | get 94 | { 95 | return _fanduty; 96 | } 97 | } 98 | /// 99 | /// CPU温度 100 | /// 101 | private string _cpuLocal; 102 | public string CpuLocal 103 | { 104 | set 105 | { 106 | _cpuLocal = value; 107 | Notify("CpuLocal"); 108 | } 109 | get 110 | { 111 | return _cpuLocal; 112 | } 113 | } 114 | /// 115 | /// 主板温度 116 | /// 117 | private string _cpuRemote; 118 | public string CpuRemote 119 | { 120 | set 121 | { 122 | _cpuRemote = value; 123 | Notify("CpuRemote"); 124 | } 125 | get 126 | { 127 | return _cpuRemote; 128 | } 129 | } 130 | /// 131 | /// 风扇当前设置 132 | /// 133 | private string _fanset; 134 | public string FanSet 135 | { 136 | set 137 | { 138 | _fanset = value; 139 | Notify("FanSet"); 140 | } 141 | get 142 | { 143 | return _fanset; 144 | } 145 | } 146 | /// 147 | /// 设置模式 148 | /// 149 | private int _fanSetModel; 150 | public int FanSetModel 151 | { 152 | set 153 | { 154 | _fanSetModel = value; 155 | Notify("FanSetModel"); 156 | } 157 | get 158 | { 159 | return _fanSetModel; 160 | } 161 | } 162 | /// 163 | /// 更新设置标识 164 | /// 165 | private bool _updateFlag; 166 | public bool UpdateFlag 167 | { 168 | set 169 | { 170 | _updateFlag = value; 171 | Notify("UpdateFlag"); 172 | } 173 | get 174 | { 175 | return _updateFlag; 176 | } 177 | } 178 | } 179 | } 180 | -------------------------------------------------------------------------------- /ECView/Pages/Windows/ECEditor.xaml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 15 | 21 | 26 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 |