Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / web / HTML

Mother's Little Helper

2.67/5 (2 votes)
27 Mar 2015CPOL4 min read 11.7K  
An application used to manage applications which are categorized by functionality which also prioritizes tasks necessary to manage a household. The application is back-end managed, controlled and operated through Microsoft's Azure cloud platform.

This article is an entry in our Microsoft Azure IoT Contest. Articles in this section are not required to be full articles so care should be taken when voting.

Introduction

Mother's Little Helper, or (MLH), is an application used to manage applications which are categorized by functionality which also prioritizes tasks necessary to manage a household. The application is back-end managed, controlled and operated through the Microsoft's Azure cloud platform. 

Background

The ultimate goal of the application is to ease the interaction and use of existing applications, and/or development of new apps, generally used to manage households, both for efficiency and safety. The focus of the value and interface for the user is to manage apps through voice recognition/interaction via Microsoft Cortana. This management would be otherwise cumbersome to accomplish through touch. The over aching theme of MLH is connectivity related apps. Furthermore MLH utilizes the paradigm of connectivity to increase efficiency for household management.

MLH will leverage actions recorded via the Microsoft Azure platform. Via telemetric analysis these actions will improve calculations and suggestions within the app.  MLH will also integrate and utilize technology offered by Microsoft's suite of applications such as, but not limited to, Bing.com Maps and Outlook's Scheduling Assistant.

The features of MLH will include;

  • A standard priority template which allows MLH to interface with other apps, eg; banking, grocery store, pharmacy, etc.
  • Ability for vocal interface with apps via Microsoft Cortana.
  • Ability to schedule actions related to events, prioritize events, and to calculate travel time based on geolocation.
  • Updated suggestions relating to activities scheduled within adjacent time frames for greater travel efficiency.
  • A premium service which would interface with connectivity-based commercial apps such as Chipolo™.
  • Ability to utilize the Microsoft Bing Maps system and the Outlook Scheduling Assistant Calendar.
  • A suite of universal apps for Windows and Windows Phone.
  • Aggregate and store information related to actions associated with the app interface in order to provide a useful dashboard of information and statistics including telemetry to improve the user's work flow.  Specifically, MLH can:
    • Maintain inventories of household purchases in order to provide alerts when items fall below certain levels.
    • Alert when household vehicles need to be serviced.
      • MLH will monitor actions and alerts of the above premium apps to provide sophisticated telemetry to ensure optimum safety of all members of the household. 
  • Chipolo™ - monitors household members’ valuables, e.g. toys, keys, clothing.
  • MeterReading™ - monitors utility usage of household and provides alerts.
  • FOBO Tire™- constantly monitors tire pressure of household vehicles
  • Birdi™- constantly monitors air quality, carbon monoxide and fire danger.

Using the code

NOTE: When app loads to a totally black screen, press and hold Search. Cortana comes on, then ask "What can I say?" Cortana responds with a list of apps and my app is in that list. Unfortunately, at this stage of development, the app does not do anything. As far as doing anything fun, well working with Cortana is just incredible.  The only issue was I could not determine what I may be doing incorrectly because I hooked a live Windows phone to the computer and at times the code worked and at other times it did not work. The point is to have the ability to create code which interacts with voice recognition is incredible. 

C++
MainPage.xaml

<Page
  x:Class="_15_03_16_hello_world_blankapp.MainPage"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:local="using:_15_03_16_hello_world_blankapp"
  xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  mc:Ignorable="d"
  Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">

  <Grid>
     
   <!--INITIATE MLH
    SET A REMINDER
    SHOP ONLINE- GROCERY STORE OR PHARMACY 
    ONLINE BANKING  
     FAMILY MEMBER MANAGEMENT 
     INITIATE INTERFACE WITH CONNECTIVY APPS--> 
    <!--<Button x:Name="clickMeButton" Content="Click Me" HorizontalAlignment="Left" Margin="143,147,0,0" VerticalAlignment="Top" Click="clickMeButton_Click"/> -->
    <TextBlock x:Name="resultTextBlock" HorizontalAlignment="Left" 
          Margin="189,324,0,0" 
          TextWrapping="Wrap" 
          VerticalAlignment="Top" 
          FontSize="48" RenderTransformOrigin="0.37,0.497"/>

  </Grid>
</Page>

//
//

MainPage.xaml.cs

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;

// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=391641

namespace _15_03_16_hello_world_blankapp
{
  /// <summary>
  /// An empty page that can be used on its own or navigated to within a Frame.
  /// </summary>
  public sealed partial class MainPage : Page
  {
    public MainPage()
    {
      this.InitializeComponent();

      this.NavigationCacheMode = NavigationCacheMode.Required;
    }

    /// <summary>
    /// Invoked when this page is about to be displayed in a Frame.
    /// </summary>
    /// <param name="e">Event data that describes how this page was reached.
    /// This parameter is typically used to configure the page.</param>
    protected override async void OnNavigatedTo(NavigationEventArgs e)
    {
      // TODO: Prepare page for display here.

      // TODO: If your application contains multiple pages, ensure that you are
      // handling the hardware Back button by registering for the
      // Windows.Phone.UI.Input.HardwareButtons.BackPressed event.
      // If you are using the NavigationHelper provided by some templates,
      // this event is handled for you.

      if (e.NavigationMode == NavigationMode.New)
      {
        var storageFile = await Windows.Storage.StorageFile.GetFileFromApplicationUriAsync
          (new Uri("ms-appx:///VoiceCom.xml"));

        await Windows.Media.SpeechRecognition.VoiceCommandManager.InstallCommandSetsFromStorageFileAsync(storageFile);
      }

    }
    ////
    //private void clickMeButton_Click(object sender, RoutedEventArgs e)
    //{
    //   resultTextBlock.Text = "V for Villanova...V for Victory!";
    //}
    //

  }
}


//
//

<Application
  x:Class="_15_03_16_hello_world_blankapp.App"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:local="using:_15_03_16_hello_world_blankapp">

</Application>


//
//


App.xaml.cs

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.ApplicationModel;
using Windows.ApplicationModel.Activation;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Media.Animation;
using Windows.UI.Xaml.Navigation;

// The Blank Application template is documented at http://go.microsoft.com/fwlink/?LinkId=391641

namespace _15_03_16_hello_world_blankapp
{
  /// <summary>
  /// Provides application-specific behavior to supplement the default Application class.
  /// </summary>
  public sealed partial class App : Application
  {
    private TransitionCollection transitions;

    /// <summary>
    /// Initializes the singleton application object.  This is the first line of authored code
    /// executed, and as such is the logical equivalent of main() or WinMain().
    /// </summary>
    public App()
    {
      this.InitializeComponent();
      this.Suspending += this.OnSuspending;
    }

    /// <summary>
    /// Invoked when the application is launched normally by the end user.  Other entry points
    /// will be used when the application is launched to open a specific file, to display
    /// search results, and so forth.
    /// </summary>
    /// <param name="e">Details about the launch request and process.</param>
     
    protected override void OnActivated(IActivatedEventArgs args)
    {
      if (args.Kind == Windows.ApplicationModel.Activation.ActivationKind.VoiceCommand)
      {
        var commandArgs = args as Windows.ApplicationModel.Activation.VoiceCommandActivatedEventArgs;
        Windows.Media.SpeechRecognition.SpeechRecognitionResult speechRecognitionResult = commandArgs.Result;

        string voiceCommandName = speechRecognitionResult.RulePath[0];
        string textSpoken = speechRecognitionResult.Text;
        string navigationTarget = speechRecognitionResult.SemanticInterpretation.Properties["NavigationTarget"][0];

        switch (voiceCommandName)
        {
          case "EventReminder":
            //EventReminder(textSpoken, navigationTarget);
            break;
          //default:
            // There is no match for the voice command name
        }
      }
    }     
    protected override void OnLaunched(LaunchActivatedEventArgs e)
    {
#if DEBUG
      if (System.Diagnostics.Debugger.IsAttached)
      {
        this.DebugSettings.EnableFrameRateCounter = true;
      }
#endif

      Frame rootFrame = Window.Current.Content as Frame;

      // Do not repeat app initialization when the Window already has content,
      // just ensure that the window is active
      if (rootFrame == null)
      {
        // Create a Frame to act as the navigation context and navigate to the first page
        rootFrame = new Frame();

        // TODO: change this value to a cache size that is appropriate for your application
        rootFrame.CacheSize = 1;

        if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
        {
          // TODO: Load state from previously suspended application
        }

        // Place the frame in the current Window
        Window.Current.Content = rootFrame;
      }

      if (rootFrame.Content == null)
      {
        // Removes the turnstile navigation for startup.
        if (rootFrame.ContentTransitions != null)
        {
          this.transitions = new TransitionCollection();
          foreach (var c in rootFrame.ContentTransitions)
          {
            this.transitions.Add(c);
          }
        }

        rootFrame.ContentTransitions = null;
        rootFrame.Navigated += this.RootFrame_FirstNavigated;

        // When the navigation stack isn't restored navigate to the first page,
        // configuring the new page by passing required information as a navigation
        // parameter
        if (!rootFrame.Navigate(typeof(MainPage), e.Arguments))
        {
          throw new Exception("Failed to create initial page");
        }
      }

      // Ensure the current window is active
      Window.Current.Activate();
    }

    /// <summary>
    /// Restores the content transitions after the app has launched.
    /// </summary>
    /// <param name="sender">The object where the handler is attached.</param>
    /// <param name="e">Details about the navigation event.</param>
    private void RootFrame_FirstNavigated(object sender, NavigationEventArgs e)
    {
      var rootFrame = sender as Frame;
      rootFrame.ContentTransitions = this.transitions ?? new TransitionCollection() { new NavigationThemeTransition() };
      rootFrame.Navigated -= this.RootFrame_FirstNavigated;
    }

    /// <summary>
    /// Invoked when application execution is being suspended.  Application state is saved
    /// without knowing whether the application will be terminated or resumed with the contents
    /// of memory still intact.
    /// </summary>
    /// <param name="sender">The source of the suspend request.</param>
    /// <param name="e">Details about the suspend request.</param>
    private void OnSuspending(object sender, SuspendingEventArgs e)
    {
      var deferral = e.SuspendingOperation.GetDeferral();

      // TODO: Save application state and stop any background activity
      deferral.Complete();
    }
  }
}


//


//

VoiceComm.xml

<?xml version="1.0" encoding="utf-8"?>

<!--VOICE COMMAND CLASS TO START APP-->

<VoiceCommands xmlns="http://schemas.microsoft.com/voicecommands/1.1">

 <CommandSet xml:lang="en-us" Name="englishCommands">

  <CommandPrefix> Start MLH</CommandPrefix>

  <Example> Start MLH</Example>

  <Command Name="EventReminder">
   <Example>What Event Would You Like Reminder</Example>

   <ListenFor>doctors appointment </ListenFor>
   <ListenFor>meeting </ListenFor>
   <ListenFor>party</ListenFor>

   <Feedback>Sure I will schedule that for you</Feedback>

   <Navigate Target="App.xaml"/>

  </Command>
 </CommandSet>

<!--VOICE COMMAND CLASS TO SET REMINDER -->
 <!--ASK WHAT REMINDER IS-->
 <!--ASK WHAT TIME FOR REMINDER -->
 <!--ASK PLACE - TAKE NAME OF PLACE TO INTEGRATE WITH BING.COM MAPS -->

<!--VOICE COMMAND CLASS TO SHOP AT GROCERY STORE OR PHARMACY-->
 <!--TAKES USER TO EITHER WEBSITE-->
 <!--ASKS USER WHEN THEY WANT TO PICK IT UP-->
 <!--KNOWS PLACE - TAKES NAME OF PLACE TO INTEGRATE WITH BING.COM MAPS-->

<!--VOICE COMMAND CLASS TO TAKE USER TO BANKING APP-->

<!--VOICE COMMAND CLASS TO ASK USER IF THEY WANT TO KEEP TRACK OF MEMBER OF HOUSEHOLD-->
 <!--ASKS USER WHO THEY WANT TO REMEMBER OR IF THEY WANT TO ADD A MEMBER - DEPENDING ON WHETHER PARENT OR CHILD DIFF STEPS-->
 <!--IF CHILD - OPTIONS ARE CHORES, Rx DOSE,HOMEWORK-->
 <!--IF PARENT - OPTIONS ARE CHORES, Rx DOSE-->

<!--VOICE COMMAND CLASS TO ASK USER WHICH CONNECTIVITY APP-->

</VoiceCommands>

Points of Interest

First and foremost by developing this app I learned about the limitless possibilities of creating apps with a cloud based framework. The advantage of the Microsoft Azure cloud platform is its vast array of features compared to other cloud platforms.  Specifically, Windows 8 and Bing.com maps offer many features and offer excellent delivery vectors for my app. Although I was unable to write functional code due to significant health challenges I have a clear vision of the remaining programmatic development required.

Second, following the prescribed Windows 8 guidelines provided me with an efficient and cohesive approach in developing an app. Furthermore Windows 8 guidelines makes future expansion of the app, as well as providing a solid and flexible foundation to develop new apps a much easier process.

Third, the Azure cloud platform is incredible. Although my exposure to resources such as this is admittedly limited to a few other resources, Azure's capabilities are incredible. By studying just the basic elements of Azure relating to how it collects and stores information, as well limitless ways to provide feedback related to data, the Azure platform has fueled ideas for future projects I would not have otherwise conceived.

Fourth and last, much of what I have learned is both new and foreign to me, and beginning work with all of the tools and resources was overwhelming. Microsoft provides both clear documentation as well as live chat help to assist, which I find incredibly amazing. To know help is just a mere click away made this process as painless as possible and without a doubt my confidence was never shaken.

This process has made me a confirmed convert to Microsoft's incredible collection of resources. 
The resources and support are flawless and have streamlined my efforts.

History

- March 6, 2015 - Inserted the first formal draft of the project summary.

- March 17, 2015 - Last two weeks was spent absorbing significant level of information relating to theories, practical implementation and specific implementation with an attempt to develop working version of app. 

- March 20, 2015 – Reviewed coding features for Cortana and Azure. Also updated and edited submission.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)