コード例 #1
0
        protected override void OnStart()
        {
            Debug.WriteLine("OnStart");

            // always re-set when the app starts
            // users expect this (usually)
            Properties ["ResumeAtTodoId"] = "";
            if (Properties.ContainsKey("ResumeAtTodoId"))
            {
                var rati = Properties ["ResumeAtTodoId"].ToString();
                Debug.WriteLine("   rati=" + rati);
                if (!String.IsNullOrEmpty(rati))
                {
                    Debug.WriteLine("   rati = " + rati);
                    ResumeAtTodoId = rati;

                    if (!string.IsNullOrEmpty(ResumeAtTodoId))
                    {
                        var todoPage = new TodoItemPageX();
                        todoPage.BindingContext = Database.GetItem(ResumeAtTodoId);

                        MainPage.Navigation.PushAsync(
                            todoPage,
                            false);                             // no animation
                    }
                }
            }
        }
コード例 #2
0
        public TodoItemListX()
        {
            InitializeComponent();

            #region toolbar
            ToolbarItem tbi = null;
            if (Device.OS == TargetPlatform.iOS)
            {
                tbi = new ToolbarItem("+", null, () =>
                {
                    var todoItem            = new TodoItem();
                    var todoPage            = new TodoItemPageX();
                    todoPage.BindingContext = todoItem;
                    Navigation.PushAsync(todoPage);
                }, 0, 0);
            }
            if (Device.OS == TargetPlatform.Android)
            { // BUG: Android doesn't support the icon being null
                tbi = new ToolbarItem("+", "plus", () =>
                {
                    var todoItem            = new TodoItem();
                    var todoPage            = new TodoItemPageX();
                    todoPage.BindingContext = todoItem;
                    Navigation.PushAsync(todoPage);
                }, 0, 0);
            }
            if (Device.OS == TargetPlatform.WinPhone || Device.OS == TargetPlatform.Windows)
            {
                tbi = new ToolbarItem("Add", "add.png", () =>
                {
                    var todoItem            = new TodoItem();
                    var todoPage            = new TodoItemPageX();
                    todoPage.BindingContext = todoItem;
                    Navigation.PushAsync(todoPage);
                }, 0, 0);
            }

            ToolbarItems.Add(tbi);

            if (Device.OS == TargetPlatform.iOS)
            {
                var tbi2 = new ToolbarItem("?", null, () =>
                {
                    var todos   = App.Database.GetItemsNotDone();
                    var tospeak = "";
                    foreach (var t in todos)
                    {
                        tospeak += t.Name + " ";
                    }
                    if (tospeak == "")
                    {
                        tospeak = "there are no tasks to do";
                    }

                    DependencyService.Get <ITextToSpeech>().Speak(tospeak);
                }, 0, 0);
                ToolbarItems.Add(tbi2);
            }
            #endregion
        }
コード例 #3
0
		protected override void OnStart()
		{
			Debug.WriteLine ("OnStart");

			// always re-set when the app starts
			// users expect this (usually)
//			Properties ["ResumeAtTodoId"] = "";
			if (Properties.ContainsKey ("ResumeAtTodoId")) {
				var rati = Properties ["ResumeAtTodoId"].ToString();
				Debug.WriteLine ("   rati="+rati);
				if (!String.IsNullOrEmpty (rati)) {
					Debug.WriteLine ("   rati = " + rati);
					ResumeAtTodoId = int.Parse (rati);

					if (ResumeAtTodoId >= 0) {
						var todoPage = new TodoItemPageX ();
						todoPage.BindingContext = Database.GetItem (ResumeAtTodoId);

						MainPage.Navigation.PushAsync (
							todoPage,
							false); // no animation
					}
				}
			}
		}
コード例 #4
0
        void listItemSelected(object sender, SelectedItemChangedEventArgs e)
        {
            var todoItem = (TodoItem)e.SelectedItem;
            var todoPage = new TodoItemPageX();

            todoPage.BindingContext = todoItem;

            Navigation.PushAsync(todoPage);
        }
コード例 #5
0
        public TodoItemListX()
        {
            InitializeComponent();

            #region toolbar
            ToolbarItem tbi = null;
            if (Device.OS == TargetPlatform.iOS)
            {
                tbi = new ToolbarItem("+", null, () =>
                {
                    var todoItem = new TodoItem();
                    var todoPage = new TodoItemPageX();
                    todoPage.BindingContext = todoItem;
                    Navigation.PushAsync(todoPage);
                }, 0, 0);
            }
            if (Device.OS == TargetPlatform.Android)
            { // BUG: Android doesn't support the icon being null
                tbi = new ToolbarItem("+", "plus", () =>
                {
                    var todoItem = new TodoItem();
                    var todoPage = new TodoItemPageX();
                    todoPage.BindingContext = todoItem;
                    Navigation.PushAsync(todoPage);
                }, 0, 0);
            }
            if (Device.OS == TargetPlatform.WinPhone || Device.OS == TargetPlatform.Windows)
            {
                tbi = new ToolbarItem("Add", "add.png", () =>
                {
                    var todoItem = new TodoItem();
                    var todoPage = new TodoItemPageX();
                    todoPage.BindingContext = todoItem;
                    Navigation.PushAsync(todoPage);
                }, 0, 0);
            }

            ToolbarItems.Add(tbi);

            if (Device.OS == TargetPlatform.iOS)
            {
                var tbi2 = new ToolbarItem("?", null, () =>
                {
                    var todos = App.Database.GetItemsNotDone();
                    var tospeak = "";
                    foreach (var t in todos)
                        tospeak += t.Name + " ";
                    if (tospeak == "") tospeak = "there are no tasks to do";

                    DependencyService.Get<ITextToSpeech>().Speak(tospeak);
                }, 0, 0);
                ToolbarItems.Add(tbi2);
            }
            #endregion
        }
コード例 #6
0
        void listItemSelected(object sender, SelectedItemChangedEventArgs e)
        {
            var todoItem = (TodoItem)e.SelectedItem;
            var todoPage = new TodoItemPageX();
            todoPage.BindingContext = todoItem;

            ((App)App.Current).ResumeAtTodoId = todoItem.ID;
            Debug.WriteLine("setting ResumeAtTodoId = " + todoItem.ID);

            Navigation.PushAsync(todoPage);
        }
コード例 #7
0
        void listItemSelected(object sender, SelectedItemChangedEventArgs e)
        {
            var todoItem = (TodoItem)e.SelectedItem;
            var todoPage = new TodoItemPageX();
            todoPage.BindingContext = todoItem;

            ((App)App.Current).ResumeAtTodoId = todoItem.ID;
            Debug.WriteLine("setting ResumeAtTodoId = " + todoItem.ID);

            Navigation.PushAsync(todoPage);
        }
コード例 #8
0
        public TodoListPage()
        {
            Title = "Todo";

            listView = new ListView();
            listView.ItemTemplate = new DataTemplate
                                        (typeof(TodoItemCell));
            listView.ItemSelected += (sender, e) => {
                var todoItem = (TodoItem)e.SelectedItem;
                var todoPage = new TodoItemPageX();
                todoPage.BindingContext = todoItem;

                ((App)App.Current).ResumeAtTodoId = todoItem.ID;
                Debug.WriteLine("setting ResumeAtTodoId = " + todoItem.ID);

                Navigation.PushAsync(todoPage);
            };

            var layout = new StackLayout();

            if (Device.OS == TargetPlatform.WinPhone)               // WinPhone doesn't have the title showing
            {
                layout.Children.Add(new Label {
                    Text     = "Todo",
                    FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label))
                });
            }
            layout.Children.Add(listView);
            layout.VerticalOptions = LayoutOptions.FillAndExpand;
            Content = layout;

            #region toolbar
            ToolbarItem tbi = null;
            if (Device.OS == TargetPlatform.iOS)
            {
                tbi = new ToolbarItem("+", null, () =>
                {
                    var todoItem            = new TodoItem();
                    var todoPage            = new TodoItemPageX();
                    todoPage.BindingContext = todoItem;
                    Navigation.PushAsync(todoPage);
                }, 0, 0);
            }
            if (Device.OS == TargetPlatform.Android)               // BUG: Android doesn't support the icon being null
            {
                tbi = new ToolbarItem("+", "plus", () => {
                    var todoItem            = new TodoItem();
                    var todoPage            = new TodoItemPageX();
                    todoPage.BindingContext = todoItem;
                    Navigation.PushAsync(todoPage);
                }, 0, 0);
            }
            if (Device.OS == TargetPlatform.WinPhone || Device.OS == TargetPlatform.Windows)
            {
                tbi = new ToolbarItem("Add", "add.png", () =>
                {
                    var todoItem            = new TodoItem();
                    var todoPage            = new TodoItemPageX();
                    todoPage.BindingContext = todoItem;
                    Navigation.PushAsync(todoPage);
                }, 0, 0);
            }

            ToolbarItems.Add(tbi);

            if (Device.OS == TargetPlatform.iOS)
            {
                var tbi2 = new ToolbarItem("?", null, () => {
                    var todos   = App.Database.GetItemsNotDone();
                    var tospeak = "";
                    foreach (var t in todos)
                    {
                        tospeak += t.Name + " ";
                    }
                    if (tospeak == "")
                    {
                        tospeak = "there are no tasks to do";
                    }

                    DependencyService.Get <ITextToSpeech>().Speak(tospeak);
                }, 0, 0);
                ToolbarItems.Add(tbi2);
            }
            #endregion
        }