This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
---------------------------------------------------- | |
// Using WebBrowser for Crowling in WPF | |
---------------------------------------------------- | |
<WebBrowser Cursor="Arrow" Name="MyBrowser" LoadCompleted="MyBrowser_OnLoadCompleted" /> | |
---------------------------------------------------- | |
// useful methods of WebBrowser | |
---------------------------------------------------- | |
MyBrowser.Navigate(new Uri("http://google.com")); | |
private void MyBrowser_OnLoadCompleted(object sender,NavigationEventArgs e) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// App.xaml in Root folder of project | |
<Application> | |
<Application.Resources> | |
<ResourceDictionary> | |
<ResourceDictionary.MergedDictionaries> | |
<ResourceDictionary Source="/ProcessStyle.xaml"/> | |
</ResourceDictionary.mergedDictionaries> | |
</ResourceDictionary> | |
</Application.Resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
------------------------------------------- | |
//How To use Processbar in WPF | |
------------------------------------------- | |
<ProgressBar Name="PbMain" Margin="3" Height="30" Width="400" /> | |
------------------------------------------- | |
//Code Behind | |
------------------------------------------- | |
public partial class MainWindow | |
{ | |
//Create a Delegate that matches the Signature of the ProgressBar's SetValue method |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Function to copy all files from one directory to another( if destination dir not exist then create it ) | |
/// </summary> | |
/// <param name="sourceDirName">path of source directory</param> | |
/// <param name="destDirName">path of destination directory</param> | |
/// <param name="copySubDirs">want to copy sub directories or not</param> | |
private static void DirectoryCopy(string sourceDirName, string destDirName, bool copySubDirs) | |
{ | |
DirectoryInfo dir = new DirectoryInfo(sourceDirName); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.Win32.TaskScheduler; | |
private void AddTask() | |
{ | |
// Get the service on the local machine | |
using (TaskService ts = new TaskService()) | |
{ | |
// Create a new task definition and assign properties | |
TaskDefinition td = ts.NewTask(); | |
td.RegistrationInfo.Description = "Tesing Schedule"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Process For Get Backup of Your Database | |
System.Diagnostics.Process myProcess = new System.Diagnostics.Process(); | |
myProcess.StartInfo.FileName = "OSQL.exe"; | |
myProcess.StartInfo.WorkingDirectory = @"C:\"; | |
myProcess.StartInfo.Arguments = "-Usa -PmyPasword -n -Q \"BACKUP DATABASE msdb TO DISK = > 'c:\\msdb.dat_bak'\""; | |
myProcess.Start() | |
//Open Folder | |
public void OpenFolder(string dir) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Window x:Class="temp.MainWindow" | |
xmlns:water="clr-namespace:temp" ... > | |
<Grid> | |
<TextBox Name="txtName" > | |
<water:WatermarkService.Watermark> | |
<TextBlock Text="Enter Your Name"/> | |
</water:WatermarkService.Watermark> | |
</TextBox> | |
</Grid> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// How to set Style to All Same Type of Controls | |
<Window.Resources> | |
//GroupBox,TextBox,Button,Grid | |
//Set background Black of all GroupBox in current Window | |
<Style TargetType="{x:Type GroupBox}"> | |
<Setter Property="Background" Value="Black"/> | |
</Style> | |
</Window.Resources> | |
//Use of Radio Button |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void btnBackupWin_Click(object sender, RoutedEventArgs e) | |
{ | |
try | |
{ | |
if (_conSource != null && dgSource.Visibility==Visibility.Visible) | |
{ | |
var dialog = new System.Windows.Forms.FolderBrowserDialog | |
{ | |
Description = @"Select Folder to store backup file : " | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class NumericComparer : System.Collections.IComparer | |
{ | |
public NumericComparer() | |
{ } | |
public int Compare(object x, object y) | |
{ | |
if ((x is string) && (y is string)) | |
{ | |
return StringLogicalComparer.Compare((string)x, (string)y); |
OlderNewer