Showing posts with label Visual Studio. Show all posts
Showing posts with label Visual Studio. Show all posts

Thursday, September 26, 2013

Windows Phone 8 development - Change icon color depending on phone background

Smart way to change icon color:

<Border x:Name="Wifi" Width="76" Height="76" 
                    HorizontalAlignment="Right" VerticalAlignment="Bottom" 
                    Background="{StaticResource PhoneForegroundBrush}"                                Margin="0,0,360,82" Tap="WhenTappedWifi" >
        <Border.OpacityMask>
             <ImageBrush ImageSource="Assets/Tiles/Custom/wifi.png" />
        </Border.OpacityMask>
</Border>

Windows Phone 8 - Navigate To and From Page

I needed a solution to change the state of an element when going back to the page where it was.
I tried the Loaded event, but this did not do the trick.
What worked was Page Navigation:

protected override void OnNavigatedFrom(System.Windows.Navigation.NavigationEventArgs e)
{
    base.OnNavigatedFrom(e);

    // code
}

protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
    base.OnNavigatedTo(e);

    // code
}

Source: http://nicksnettravels.builttoroam.com/post/2011/03/07/Windows-Phone-7-Tombstone-Frustration.aspx

Tuesday, September 24, 2013

Windows Phone 8 Apps - Icon collection sources

I have found myself looking for icons many times.
So I have decided to create a list with good sources.
Here it is, to be continued...

http://www.geekchamp.com/icon-explorer/introduction

Windows Phone 8 - Launch built-in apps - LaunchUriAsync

Few functions with LaunchUriAsync method:


http:[URL]To launch web browser and navigate to specific web URL address
mailto:[email-address]To launch email app with To is set to email-address specified
ms-settings-accounts:To open Account Settings app
ms-settings-airplanemode:To launch Airplane Settings app
ms-settings-bluetooth:To launch Bluetooth Settings app
ms-settings-cellular:To open Cellular Settings app
ms-settings-emailandaccounts:To launch Email and Accounts Settings app
ms-settings-location:To display Locations Settings app
ms-settings-lock:To launch Lock Screen Settings app
ms-settings-wifi:To open Wi-Fi Settings app
zune:navigate?appid=[App Id]To navigate to app details page on Windows Phone Store
zune:reviewappTo open review page for calling app on Windows Phone Store
zune:reviewapp?appid=[App Id]To launch reviews page for specified app
zune:search?[search parameter]=[value]To search Windows Phone Store
zune:search?keyword=[search keyword]&contenttype=appTo search Windows Phone apps by keyword
zune:search?publisher=[publisher name]To launch Windows Store and search publishers apps

Example:
private async void WhenTappedWifi(object sender, System.Windows.Input.GestureEventArgs e)
        {
            Uri uri = new Uri("ms-settings-wifi:");
            await Windows.System.Launcher.LaunchUriAsync(uri);
        }

Source:

Friday, September 20, 2013

Increase 250 users limit using command line

If you need to perform Load Tests in Visual Studio with more than 250 users, here is what you need to do:

1. Click Start ->  All Programs -> Microsoft Visual Studio 2010 ->Visual Studio Tools, and then right-click Visual Studio 2010 Command Prompt -> Run as Administrator.
2. Type the following command:
 VSTestConfig Licenses /AddKey:AAAAA-BBBBB-CCCCC-DDDDD-EEEEE.

Note: To get the license key:
- login to your MSDN Subscription -> My Product Keys ( https://msdn.microsoft.com/en-us/subscriptions/keys/ ) -> Visual Studio 2010 -> Visual Studio Load Test Virtual User Pack 2010  

Source:


Tuesday, August 21, 2012

Coded UI - Close process by process name


This is an example to close Firefox, but can be used for any other process:

//close Firefox
            Process[] processes = Process.GetProcessesByName("firefox");
            foreach (Process process in processes)
            {
                process.Kill();
                process.WaitForExit();
            }  

Coded UI - Add messages in Results

If you need messages in Results:

Assert.Fail("Login page not available"); - test will fail and the message will be displayed in Results
this.TestContext.WriteLine("Login page available"); - test will pass and the message will be displayed in Results

Coded UI - Select text and replace


This is useful sometimes:

Mouse.Click(this.TestRunner.Login.UIMozillaWindow.UIItemDocument.UIGeneralPasswortEdit);
Keyboard.SendKeys(this.TestRunner.Login.UIMozillaWindow.UIItemDocument.UIGeneralPasswortEdit, "A", ModifierKeys.Control);
Keyboard.SendKeys("1234567");   

Thursday, July 12, 2012

Open cmd.exe in specific directory

If you need to open cmd.exe in specific directory and run a command, here is what you need to do:

var processStartInfo = new ProcessStartInfo();
processStartInfo.WorkingDirectory = @"c:\";
processStartInfo.FileName = "cmd.exe";

// set additional properties     
Process proc = Process.Start(processStartInfo);