Changeset 117
- Timestamp:
- Dec 18, 2008, 8:03:25 PM (15 years ago)
- Location:
- trunk/MacFaceFloat
- Files:
-
- 2 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MacFaceFloat/MacFaceApp.cs
r111 r117 13 13 using System.IO; 14 14 using System.Reflection; 15 using System.Drawing.Imaging; 16 using System.Runtime.InteropServices; 15 17 16 18 namespace MacFace.FloatApp … … 41 43 private MacFace.FaceDef curFaceDef; 42 44 43 [STAThread] 45 private IOptimusMini optimusMini; 46 47 [STAThread] 44 48 public static void Main(string[] args) 45 49 { … … 126 130 } 127 131 132 //IOptimusMini.OnKeyDownCallbackDelegate oKD = new IOptimusMini.OnKeyDownCallbackDelegate(OnKeyDownCallbackHandler); 133 //IOptimusMini.OnDeviceStateChangedCallbackDelegate oDSC = new IOptimusMini.OnDeviceStateChangedCallbackDelegate(OnDeviceStateChangedCallbackHandler); 134 //IOptimusMini.RegisterEventHandler(oKD, oDSC); 135 128 136 patternWindow = null; 129 137 statusWindow = null; 130 138 131 139 InitializeComponent(); 140 141 optimusMini = new IOptimusMini(); 142 optimusMini.DisplayOn(); 132 143 133 144 CountProcessorUsage(null, null); … … 138 149 updateTimer.Tick += new EventHandler(this.CountProcessorUsage); 139 150 } 151 152 void OnKeyDownCallbackHandler(int key) 153 { 154 Console.Write("Keydown {0}\n", key); 155 } 156 157 void OnDeviceStateChangedCallbackHandler(int state) 158 { 159 //useOptimusMini = (state > 0); 160 } 140 161 141 162 void InitializeComponent() … … 232 253 { 233 254 notifyIcon.Visible = false; 234 235 255 config.Save(); 236 } 256 optimusMini.Dispose(); 257 } 237 258 238 259 public bool LoadFaceDefine(string path) … … 302 323 if (pageio_count < 0) pageio_count = 0; 303 324 325 int pattern = cpuUsage.Active / 10; 326 pattern += memUsage.Pageout / 15; 327 pattern += memUsage.Pagein / 30; 328 if (pattern > 10) pattern = 10; 329 330 FaceDef.PatternSuite suite = FaceDef.PatternSuite.Normal; 331 332 UInt64 avilable = (UInt64)memStats.TotalVisibleMemorySize * 1024 - memUsage.Used; 333 if (pageio_count > 100) 334 { 335 suite = FaceDef.PatternSuite.MemoryInsufficient; 336 } 337 else if (avilable < 0) 338 { 339 suite = FaceDef.PatternSuite.MemoryDecline; 340 } 341 342 int markers = FaceDef.MarkerNone; 343 if (memUsage.Pagein > 0) markers += FaceDef.MarkerPageIn; 344 if (memUsage.Pageout > 0) markers += FaceDef.MarkerPageOut; 345 304 346 if (patternWindow != null) 305 347 { 306 int pattern = cpuUsage.Active / 10;307 pattern += memUsage.Pageout / 15;308 pattern += memUsage.Pagein / 30;309 if (pattern > 10) pattern = 10;310 311 FaceDef.PatternSuite suite = FaceDef.PatternSuite.Normal;312 313 UInt64 avilable = (UInt64)memStats.TotalVisibleMemorySize * 1024 - memUsage.Used;314 if (pageio_count > 100)315 {316 suite = FaceDef.PatternSuite.MemoryInsufficient;317 }318 else if (avilable < 0)319 {320 suite = FaceDef.PatternSuite.MemoryDecline;321 }322 323 int markers = FaceDef.MarkerNone;324 if (memUsage.Pagein > 0) markers += FaceDef.MarkerPageIn;325 if (memUsage.Pageout > 0) markers += FaceDef.MarkerPageOut;326 327 348 patternWindow.UpdatePattern(suite, pattern, markers); 328 349 } … … 332 353 statusWindow.UpdateGraph(); 333 354 } 355 356 if (optimusMini.IsAlive && curFaceDef != null) 357 { 358 Bitmap image = new Bitmap(96, 96); 359 Graphics g = Graphics.FromImage(image); 360 g.FillRectangle(new SolidBrush(Color.White), 0, 0, image.Width, image.Height); 361 curFaceDef.DrawPatternImage(g, suite, pattern, markers, 96F / 128F); 362 g.Dispose(); 363 364 optimusMini.ShowPicture(1, image); 365 } 334 366 } 335 367 … … 414 446 private void configForm_ConfigChanged() 415 447 { 416 if (patternWindow.FaceDef.Path != config.FaceDefPath) 417 418 419 420 if (!result) 421 422 423 424 425 426 448 if (curFaceDef.Path != config.FaceDefPath) 449 { 450 bool result = LoadFaceDefine(config.FaceDefPath); 451 // p^[ÏXɸsµ½çÝèð³Éß· 452 if (!result) 453 { 454 config.FaceDefPath = patternWindow.FaceDef.Path; 455 } 456 } 457 458 if (patternWindow != null) 427 459 { 428 460 patternWindow.Opacity = (float)config.Opacity / 100; -
trunk/MacFaceFloat/MacFaceFloat.csproj
r115 r117 2 2 <PropertyGroup> 3 3 <ProjectType>Local</ProjectType> 4 <ProductVersion>9.0. 30729</ProductVersion>4 <ProductVersion>9.0.21022</ProductVersion> 5 5 <SchemaVersion>2.0</SchemaVersion> 6 6 <ProjectGuid>{60DE0E19-7B98-41E8-8001-A8C7A75AF08E}</ProjectGuid> … … 150 150 <SubType>Form</SubType> 151 151 </Compile> 152 <Compile Include="IOptimusMini.cs"> 153 <SubType>Code</SubType> 154 </Compile> 152 155 <Compile Include="MacFaceApp.cs"> 153 156 <SubType>Code</SubType> … … 252 255 <Content Include="kikiki-rin.mcface\note.tiff" /> 253 256 <Content Include="kikiki-rin.mcface\shock.tiff" /> 257 <Content Include="OptimusMini.dll" /> 254 258 </ItemGroup> 255 259 <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> 256 260 <PropertyGroup> 257 261 <PreBuildEvent>"$(ProjectDir)PreBuild_GenerateAssemblyInfoVersionPart.cmd" > "$(ProjectDir)AssemblyInfoVersionPart.cs"</PreBuildEvent> 258 <PostBuildEvent>xcopy /Y /I "$(ProjectDir)default.mcface" "$(TargetDir)default.mcface"</PostBuildEvent> 262 <PostBuildEvent>xcopy /Y /I "$(ProjectDir)default.mcface" "$(TargetDir)default.mcface" 263 copy "$(ProjectDir)OptimusMini.dll" "$(TargetDir)OptimusMini.dll" 264 </PostBuildEvent> 259 265 </PropertyGroup> 260 266 </Project>
Note: See TracChangeset
for help on using the changeset viewer.