Using Poweshell to kill all the process with name containing particular string

Get-Process| where{ ( $_.Name.ToUpper().Contains(“MAGIC”) ) }| foreach { $_.Kill() }

SAcha Question

Reference Site for C#

http://www.java2s.com/

WPF localization Start

http://robertoschiabel.wordpress.com/2010/01/31/wpf-add-localization-via-resx-files/

The above link is very useful for starters

Debugging Data Binding

http://www.codeproject.com/Articles/244107/Debugging-WPF-data-bindings

(1)  Add a App.Config File

(2) Paste the following code in <Configuration> tags

<system.diagnostics>
    <sources>
        <source name="System.Windows.Data" switchName="mySwitch">
            <listeners>
                <add name="myListener" />
            </listeners>
        </source>
    </sources>

    <switches>
        <add name="mySwitch" value="All" />
    </switches>

    <sharedListeners>
        <add name="myListener" type="System.Diagnostics.TextWriterTraceListener"
             initializeData="DataBindingTrace.txt" />
    </sharedListeners>
</system.diagnostics>

(3) See the magic in bin folder.

Linq TO XML

http://www.dotnetcurry.com/ShowArticle.aspx?ID=564

Changing SlectionColor of ListViewItem

<Window.Resources>
<Style TargetType=”ListViewItem”>
<Style.Resources>
<SolidColorBrush x:Key=”{x:Static SystemColors.HighlightBrushKey}” Color=”Green”/>
<SolidColorBrush x:Key=”{x:Static SystemColors.ControlBrushKey}” Color=”LightBlue”/>
</Style.Resources>
</Style>
</Window.Resources>

Boolean To Visibilty Converter

Code for Converter  

Public class BoolToVisibilityConverter : MarkupExtension, IValueConverter
{
public BoolToVisibilityConverter()
{
TrueValue = Visibility.Visible;
FalseValue = Visibility.Collapsed;
}

public Visibility TrueValue { get; set; }
public Visibility FalseValue { get; set; }

public object Convert(object value, Type targetType, objectparameter, System.Globalization.CultureInfo culture)
{
bool val = System.Convert.ToBoolean(value);
return val ? TrueValue : FalseValue;
}

public object ConvertBack(object value, Type targetType, objectparameter, System.Globalization.CultureInfo culture)
{
return TrueValue.Equals(value) ? true : false;
}

public override object ProvideValue(IServiceProvider serviceProvider)
{
return this;
}
}

Mark Up

<StackPanel VerticalAlignment=”Bottom”>
<StackPanel.Resources>
<local:BoolToVisibilityConverter FalseValue=”Collapsed”x:Key=”btvc” />
</StackPanel.Resources>
<CheckBox x:Name=”HideOrShowCheck”>Hide or show the text…
<TextBlock Text=”Hello World!” Visibility=”{Binding ElementName=HideOrShowCheck, Path=IsChecked,Converter={StaticResource btvc}}” />
</StackPanel>