Ejemplo n.º 1
0
        private void MainPageGrid_Tap_1(object sender, System.Windows.Input.GestureEventArgs e)
        {
            ListBox  listbox  = (ListBox)sender;
            MemoItem passitem = null;
            bool     find     = false;

            foreach (FrontPageControl item in listbox.SelectedItems)
            {
                string st = item.MemoDetail.Text + item.AlarmTime.ToString();
                foreach (MemoItem memo in App.Memos)
                {
                    item.TileSmaller();
                    string st1 = memo.Content + memo.RemindTime.ToString();
                    if (st == st1)
                    {
                        passitem = memo;
                        find     = true;
                        break;
                    }
                }
                if (find)
                {
                    break;
                }
            }
            App.MemoTemp = passitem;
            if (App.MemoTemp != null)
            {
                NavigationService.Navigate(new Uri("/DetailMemoPage.xaml", UriKind.Relative));
            }
        }
Ejemplo n.º 2
0
        private void GoMemoDetailTap(object sender, System.Windows.Input.GestureEventArgs e)
        {
            ListBox  listbox  = (ListBox)sender;
            MemoItem passitem = null;

            foreach (MemoItem item in listbox.SelectedItems)
            {
                passitem = item;
                break;
            }
            App.MemoTemp = passitem;
            NavigationService.Navigate(new Uri("/DetailMemoPage.xaml", UriKind.Relative));
        }
Ejemplo n.º 3
0
 public static void PinToMain(MemoItem item)
 {
     if (Flips.Count < 8)
     {
         FrontPageControl fc = new FrontPageControl();
         fc.SetKeywords(String.Join(", ", item.Keywords));
         fc.SetAlarmTime(item.RemindTime);
         fc.SetMemoDetail(item.Content);
         Flips.Add(fc);
     }
     else
     {
         Flips.RemoveAt(7);
         FrontPageControl fc = new FrontPageControl();
         fc.SetKeywords(String.Join(", ", item.Keywords));
         fc.SetAlarmTime(item.RemindTime);
         fc.SetMemoDetail(item.Content);
         Flips.Add(fc);
     }
 }
Ejemplo n.º 4
0
        public ConversationPage()
        {
            InitializeComponent();

            this.TR.btnRetrieve.Checked   += this.btnRetrieve_Checked;
            this.TR.btnTeach.Checked      += this.btnTeach_Checked;
            this.TR.btnRetrieve.Unchecked += this.btnTeach_Checked;
            this.TR.btnTeach.Unchecked    += this.btnRetrieve_Checked;
            this.TS.MouseLeftButtonDown   += this.tapToSpeakGrid_MouseLeftButtonDown;
            this.TS.MouseLeftButtonUp     += this.tapToSpeakGrid_MouseLeftButtonUp;

            this.DataContext = Conversation;

            this.SpeechUI    = new SpeechRecognizerUI();
            this.Synthesizer = new SpeechSynthesizer();

            NewMemoPopUp                     = new Popup();
            NewMemoPopUpControl              = new NewMemoPopUp();
            NewMemoPopUpControl.Width        = Application.Current.Host.Content.ActualWidth;
            NewMemoPopUpControl.btnOK.Click += (s, args) =>
            {
                MemoItem item = new MemoItem();
                item.Latitude  = this.CurrentLatitude;
                item.Longitude = this.CurrentLongitude;
                item.Content   = this.NewMemoPopUpControl.txtBox.Text;
                item.HasAlarm  = this.NewMemoPopUpControl.alarmCheck.IsChecked.Value;
                DateTime?date = NewMemoPopUpControl.datePicker.Value;
                DateTime?time = NewMemoPopUpControl.timePicker.Value;
                item.RemindTime = new DateTime(date.Value.Year, date.Value.Month, date.Value.Day,
                                               time.Value.Hour, time.Value.Minute, time.Value.Second);
                string teachRequest = JsonConvert.SerializeObject(item);
                NewMemoPopUp.IsOpen = false;
                WebClient client = new WebClient();
                client.Headers[HttpRequestHeader.ContentType] = "application/json";
                client.Headers[HttpRequestHeader.Accept]      = "application/json";
                client.UploadStringAsync(new Uri(String.Format(Api.TeachUri, Phone.ID)), teachRequest);
                client.UploadStringCompleted += async(obj, e) =>
                {
                    if (e.Error == null)
                    {
                        if (item.HasAlarm)
                        {
                            Reminder reminder = new Reminder(item.RemindTime.ToString());
                            reminder.Title          = "Speech Memo Reminder";
                            reminder.Content        = item.Content;
                            reminder.BeginTime      = item.RemindTime;
                            reminder.ExpirationTime = item.RemindTime + new TimeSpan(0, 5, 0);
                            reminder.NavigationUri  = new Uri("/MainPage.xaml", UriKind.Relative);
                            try
                            {
                                ScheduledActionService.Add(reminder);
                            }
                            catch
                            {
                            }
                        }
                        string       x      = JsonConvert.DeserializeObject <string>(e.Result);
                        IAsyncAction action = this.Synthesizer.SpeakTextAsync(x);
                        this.Conversation.Add(new Message(x, MessageSide.Cloud));
                        this.BeginScrollDown();
                        await action;
                    }
                    else
                    {
                        await HandleInternetException();
                    }
                };
            };

            NewMemoPopUpControl.btnCancel.Click += (s, args) =>
            {
                NewMemoPopUp.IsOpen = false;
            };

            NewMemoPopUp.Child = NewMemoPopUpControl;
            Startup();
        }