optimizing timer
This commit is contained in:
		
							parent
							
								
									ceca9ef25a
								
							
						
					
					
						commit
						d0f2f84a32
					
				| @ -20,9 +20,13 @@ namespace STDHelper | ||||
|     { | ||||
|         private DispatcherTimer t; | ||||
|         private BitmapSource lastImage; | ||||
|         private System.Windows.Controls.Image i1; | ||||
|         private System.Windows.Controls.Image i2; | ||||
|         public MainWindow() | ||||
|         { | ||||
|             InitializeComponent(); | ||||
|             i1 = FindName("image1") as System.Windows.Controls.Image; | ||||
|             i2 = FindName("image2") as System.Windows.Controls.Image; | ||||
|             System.Windows.Controls.ComboBox cb = FindName("cb_Screens") as System.Windows.Controls.ComboBox; | ||||
|             Screen[] screens = Screen.AllScreens; | ||||
|             foreach(Screen s in screens) | ||||
| @ -34,7 +38,7 @@ namespace STDHelper | ||||
|             t = new DispatcherTimer(); | ||||
|             // Hook up the Elapsed event for the timer.  | ||||
|             t.Tick += new EventHandler(OnTimedEvent); | ||||
|             t.Interval = new TimeSpan(0, 0, 1); | ||||
|             t.Interval = new TimeSpan(0,0,0,0,500); | ||||
|         } | ||||
| 
 | ||||
|         private WriteableBitmap getAreaFromBitmap(BitmapSource src, Int32Rect area) | ||||
| @ -67,8 +71,6 @@ namespace STDHelper | ||||
| 
 | ||||
|         private void Btn_Switch_Click(object sender, RoutedEventArgs e) | ||||
|         { | ||||
|             System.Windows.Controls.Image i1 = FindName("image1") as System.Windows.Controls.Image; | ||||
|             System.Windows.Controls.Image i2 = FindName("image2") as System.Windows.Controls.Image; | ||||
|             if (t.IsEnabled) | ||||
|             { | ||||
|                 t.Stop(); | ||||
| @ -88,8 +90,6 @@ namespace STDHelper | ||||
|         private void OnTimedEvent(object sender, EventArgs e) | ||||
|         { | ||||
|             Debug.WriteLine("TICK"); | ||||
|             System.Windows.Controls.Image i1 = FindName("image1") as System.Windows.Controls.Image; | ||||
|             System.Windows.Controls.Image i2 = FindName("image2") as System.Windows.Controls.Image; | ||||
|             Debug.WriteLine("i1 " + i1.Visibility); | ||||
|             Debug.WriteLine("i2 " + i2.Visibility); | ||||
|             if (i1.Visibility == Visibility.Hidden) | ||||
| @ -105,8 +105,6 @@ namespace STDHelper | ||||
| 
 | ||||
|         private void Btn_LoadScreenshot_Click(object sender, RoutedEventArgs e) | ||||
|         { | ||||
|             System.Windows.Controls.Image i1 = FindName("image1") as System.Windows.Controls.Image; | ||||
|             System.Windows.Controls.Image i2 = FindName("image2") as System.Windows.Controls.Image; | ||||
|             System.Windows.Controls.ComboBox cb = FindName("cb_Screens") as System.Windows.Controls.ComboBox; | ||||
|             string scrStr = cb.SelectedItem as string; | ||||
|             Screen screen = Screen.AllScreens.Where(elem => elem.DeviceName == scrStr).SingleOrDefault(); | ||||
|  | ||||
| @ -60,7 +60,10 @@ | ||||
|     <GenerateManifests>true</GenerateManifests> | ||||
|   </PropertyGroup> | ||||
|   <PropertyGroup> | ||||
|     <SignManifests>true</SignManifests> | ||||
|     <SignManifests>false</SignManifests> | ||||
|   </PropertyGroup> | ||||
|   <PropertyGroup> | ||||
|     <NoWin32Manifest>true</NoWin32Manifest> | ||||
|   </PropertyGroup> | ||||
|   <ItemGroup> | ||||
|     <Reference Include="System" /> | ||||
| @ -120,7 +123,6 @@ | ||||
|       <Generator>SettingsSingleFileGenerator</Generator> | ||||
|       <LastGenOutput>Settings.Designer.cs</LastGenOutput> | ||||
|     </None> | ||||
|     <None Include="STDHelper_TemporaryKey.pfx" /> | ||||
|   </ItemGroup> | ||||
|   <ItemGroup> | ||||
|     <None Include="App.config" /> | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user