Windows Runtime – C# Send EMail from App

Windows-Dev

I’m working on my About page for a Windows Phone Runtime app and needed to be able to send an email for feedback or support issues.

Below is the code for my event handler in the code behind (AboutPage.cs):

        async private void Image_Email(object sender, TappedRoutedEventArgs e)
        {
            //Define email address to send to
            EmailRecipient sendTo = new EmailRecipient()
            {
                Address = "mail@domain.com"
            };

            //New email and define email subject
            EmailMessage mail = new EmailMessage();
            mail.Subject = "Linux Essentials - Feedback";

            //Add addressee to email
            mail.To.Add(sendTo);

            //Open share contact with email only
            await EmailManager.ShowComposeNewEmailAsync(mail);
        }

The XAML on my About page is simply an image with the Tapped event:

      <Image Source="Assets/Images/Mail.png"
             Height="64"
             Width="64"
             Margin="0,0,22,0"
             Tapped="Image_Email"/>

When defining a new email you can also specify the mail body text:

mail.Body = "this is the Body";

Source: http://dotnet.dzone.com/articles/how-send-mail-your-windows

Windows Runtime – C# Launch Hyperlink

Windows-Dev

I’m working on my About page for a Windows Phone Runtime app and needed to open a hyperlink in my code behind (AboutPage.cs).

Below is the code for my Tapped event handler:

        private void Image_Wordpress(object sender, TappedRoutedEventArgs e)
        {
            Launcher.LaunchUriAsync(new Uri("https://pricklytech.wordpress.com/"));
        }

The XAML on my About page is simply an image with the Tapped event:

      <Image Source="Assets/Images/Wordpress.png"
             Height="64"
             Width="64"
             Tapped="Image_Wordpress"/>

Source: http://stackoverflow.com/questions/12501174/opening-a-url-in-the-default-browser-in-a-windows-8-desktop-application

Quick Tip: Removing Favorites, Frequent Folders and Recent Files from the Home folder in Windows 10

Windows 8 Logo

In the Windows 10 Technical Preview File Explorer defaults to the Home folder which shows Favorites, Frequent Folders and Recent Files.

Win 10 Home Folder

To remove these folders we need to edit the registry. Click the Start button and then type regedit.exe and press Enter.

Navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\HomeFolder. To make a backup of this folder right click it and then select Export and save it.

Expand the folders beneath HomeFolder and you will see the NameSpace and DelegateFolders. The latter contains three GUIDs for the Frequent Places Folder, Recent Items Instance Folder and the Favorites Folder respectively.

Win 10 Regedit Home Folders

Right click on each GUID that you wish to remove and then select Delete and they will no longer appear in your Home Folder in File Explorer.

Source: http://www.wpcentral.com/new-windows-10-home-folder-convenient-or-bad-privacy

 

Quick Tip: How to Enable Internet Explorer Modern App in Windows 10

Windows 8 Logo

The Modern (Metro) Internet Explorer (IE) app is missing from the Windows 10 Technical Preview.

I find this a bit curious as I use Modern IE to share URLs with the Reading List app.

Fortunately @adamUCF created a PowerShell script that launches Modern IE.

Copy the script into a text document and then change the file extension to .ps1. Right click the PowerShell script and then select Run with PowerShell to run Modern IE.

$code = @"
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
namespace Win8 {

    [ComImport, Guid("2e941141-7f97-4756-ba1d-9decde894a3d"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    interface IApplicationActivationManager
    {
        IntPtr ActivateApplication([In] String appUserModelId, [In] String arguments, [In] UInt32 options, [Out] out UInt32 processId);
    }

[ComImport, Guid("45BA127D-10A8-46EA-8AB7-56EA9078943C")]//Application Activation Manager
    public class ApplicationActivationManager : IApplicationActivationManager
    {
        [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)/*, PreserveSig*/]
        public extern IntPtr ActivateApplication([In] String appUserModelId, [In] String arguments, [In] UInt32 options, [Out] out UInt32 processId);

    }

}
"@

add-type -TypeDefinition $code
$appman = new-object Win8.ApplicationActivationManager

$appman.ActivateApplication("DefaultBrowser_NOPUBLISHERID!Microsoft.InternetExplorer.Default",$null,0,[ref]0)

You will need to run this script each time that you want to open Modern IE.

Sources: http://www.wpcentral.com/heres-how-get-modern-version-ie-running-windows-10-technical-preview

Windows 8.1 – How to Change the Accent Color

Windows 8 Logo

I ran through the Out of Box Experience too quickly yesterday on Windows 8.1 and forgot to change the accent color. It’s fortunately simple to change.

On the Start Screen type personalize and then select Change the background and colors on start.

Next simply select the accent color from the Personalize panel:

Personalize

Inkscape – Change the white background workspace to a transparent color

Windows 8 Logo

If you want to change the default workspace color in Inkscape from white to another color – here’s how to do it:

  • Press Ctrl, Shift and D to open the Document Properties window
  • Click on the Background color

Inkscape-background

  • Change the RGBA value to 888888FF

Inkscape-Backround-Color

Note: 888888 defines the color in hex – FF makes the color fully transparent.

Your workspace will now have a grey background.

Source: http://stackoverflow.com/questions/3510482/transparency-vs-white-background-in-inkscape

Enemy Territory – Cannot Adjust Gamma (Brightness)

Windows 8 Logo

I just installed Enemy Territory on Windows 8.1 and ran into a problem – I could not adjust the brightness (gamma) in the game. The slider would work and the brightness would flicker but then return to the default value.

I tried adjusting the Compatibility mode for the game and tried adjusting the gamma using the console in game:

/set r_gamma 1.5
/r_ignorehwgamma 1

The error in the console was this:

set DeviceGammaRamp failed

The solution turned out to be very simple – just turn off f.lux and everything was OK again!

If you have not heard of f.lux before it is a program that makes the color of your computer’s display adapt to the time of day.

Windows 8.x – List Installed Software

Windows 8 Logo

It is often useful to generate a list of installed software on a system and here is a quick and easy way to do it.

Open an Administrator Command Prompt using one of these methods:

  • Press Windows + x on the keyboard and then select Command Prompt (Admin) from the pop-up menu
  • On the Windows Start Screen swipe up from the bottom and then tap and hold the Command Prompt icon and then tap Run as administrator on the toolbar

Type the following command to enter the Windows Management Instrumentation Command-line (WMIC):

wmic

To generate a list of installed software in a file called C:\InstalledSoftware.txt enter this command:

/output:C:\InstalledSoftware.txt product get name,version

It doesn’t look like this method lists Windows Store Apps very well, but they are easily installed from the Store (particularly if you have Apps synced between devices).

Source: http://helpdeskgeek.com/how-to/generate-a-list-of-installed-programs-in-windows/