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

            string id = "";
            if (NavigationContext.QueryString.TryGetValue("id", out id))
            {
                System.Diagnostics.Debug.WriteLine("id: " + id.ToString());
                Message msg = MessageData.Instance.Messages.FirstOrDefault(m => m.ID == id);
                if (msg != null)
                {
                    _message = msg;
                    this.DataContext = _message;
                }
            }
        }
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            System.Diagnostics.Debug.WriteLine("EditMessagePage:OnNavigatedTo");

            string id = "";
            if (this.State.ContainsKey(EDIT_STATE_KEY))
            {
                // Retrieve Message from state
                Message stateMessage = (Message)this.State[EDIT_STATE_KEY];

                // Strange data binding behavior; on Activated from Tombstoning, we need to pull reference from
                // our persistent storage and manually set values based on the last state of the form
                // TODO: Investigate weird data binding issue
                _currentMessage = MessageData.Instance.Messages.FirstOrDefault(m => m.ID == stateMessage.ID);
                if (_currentMessage != null)
                {
                    // Build form from state values
                    _currentMessage.Text = stateMessage.Text;
                    _currentMessage.AnimationType = stateMessage.AnimationType;
                    _currentMessage.Speed = stateMessage.Speed;
                    _currentMessage.FontScale = stateMessage.FontScale;
                    _currentMessage.ForegroundColor = stateMessage.ForegroundColor;
                    _currentMessage.BackgroundColor = stateMessage.BackgroundColor;
                    _isNewMessage = false;
                }
                else
                {
                    // if it's a new message, no need to manually set property values, a reference will do
                    _currentMessage = stateMessage;
                    _isNewMessage = true;
                }
            }
            else if (NavigationContext.QueryString.TryGetValue("id", out id))
            {
                _currentMessage = MessageData.Instance.Messages.FirstOrDefault(m => m.ID == id);
                if (_currentMessage != null)
                {
                    _isNewMessage = false;
                }
            }

            if (_currentMessage == null)
            {
                // New Message
                _currentMessage = new Message();
                _isNewMessage = true;
            }

            this.DataContext = _currentMessage;
        }
        private void saveFormFields()
        {
            string itemValue = AnimationListPicker.SelectedItem.ToString().Replace(" ", "");

            _currentMessage = (Message)this.DataContext;
            _currentMessage.Text = MessageTextBox.Text;
            _currentMessage.AnimationType = (AnimationType)Enum.Parse(typeof(AnimationType), itemValue, true);
            _currentMessage.Speed = (int)SpeedSlider.Value;
            _currentMessage.FontScale = (int)FontScaleSlider.Value;
            _currentMessage.ForegroundColor = ForegroundListPicker.SelectedItem.ToString();
            _currentMessage.BackgroundColor = BackgroundListPicker.SelectedItem.ToString();
        }