Пример #1
0
 public void Update(Task item)
 {
     ID = item.ID;
     Name = item.Name;
     Notes = item.Notes;
     Done = item.Done;
 }
Пример #2
0
		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);
			
			int taskID = Intent.GetIntExtra("TaskID", 0);
			if(taskID > 0)
			{
				this._task = Tasky.BL.Managers.TaskManager.GetTask(taskID);
			}
			
			// set our layout to be the home screen
			this.SetContentView(Resource.Layout.TaskDetails);
			this._nameTextEdit = this.FindViewById<EditText>(Resource.Id.txtName);
			this._notesTextEdit = this.FindViewById<EditText>(Resource.Id.txtNotes);
			this._saveButton = this.FindViewById<Button>(Resource.Id.btnSave);
			
			// find all our controls
			this._cancelDeleteButton = this.FindViewById<Button>(Resource.Id.btnCancelDelete);
			
			
			// set the cancel delete based on whether or not it's an existing task
			if(this._cancelDeleteButton != null)
			{ this._cancelDeleteButton.Text = (this._task.ID == 0 ? "Cancel" : "Delete"); }
			
			// name
			if(this._nameTextEdit != null) { this._nameTextEdit.Text = this._task.Name; }
			
			// notes
			if(this._notesTextEdit != null) { this._notesTextEdit.Text = this._task.Notes; }
			
			// button clicks 
			this._cancelDeleteButton.Click += (sender, e) => { this.CancelDelete(); };
			this._saveButton.Click += (sender, e) => { this.Save(); };
		}
Пример #3
0
		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);

            RequestWindowFeature(WindowFeatures.ActionBar);
            ActionBar.SetDisplayHomeAsUpEnabled(true);
            ActionBar.SetHomeButtonEnabled(true);
			
			int taskID = Intent.GetIntExtra("TaskID", 0);
			if(taskID > 0) {
				task = Tasky.BL.Managers.TaskManager.GetTask(taskID);
			}
			
			// set our layout to be the home screen
			SetContentView(Resource.Layout.TaskDetails);
			nameTextEdit = FindViewById<EditText>(Resource.Id.txtName);
			notesTextEdit = FindViewById<EditText>(Resource.Id.txtNotes);
			doneCheckbox = FindViewById<CheckBox>(Resource.Id.chkDone);
						
			// name
			if(nameTextEdit != null) { nameTextEdit.Text = task.Name; }
			
			// notes
			if(notesTextEdit != null) { notesTextEdit.Text = task.Notes; }
			
			if(doneCheckbox != null) { doneCheckbox.Checked = task.Done; }
		}
 private void Add_Click(object sender, RoutedEventArgs e)
 {
     var task = new Task();
     task.Name = "<new task>";
     task.Notes = "";
     TaskManager.SaveTask(task);
     ((TaskListViewModel)DataContext).BeginUpdate();
 }
		/// <summary>Convert from DataReader to Task object</summary>
		Task FromReader(SqliteDataReader r) {
			var t = new Task ();
			t.ID = Convert.ToInt32 (r ["_id"]);
			t.Name = r ["Name"].ToString ();
			t.Notes = r ["Notes"].ToString ();
			t.Done = Convert.ToInt32 (r ["Done"]) == 1 ? true : false;
			return t;
		}
Пример #6
0
		protected void ShowTaskDetails (Task task)
		{
			currentTask = task;
			taskDialog = new TaskDialog (task);
			
			var title = Foundation.NSBundle.MainBundle.LocalizedString ("Task Details", "Task Details");
			context = new LocalizableBindingContext (this, taskDialog, title);
			detailsScreen = new DialogViewController (context.Root, true);
			ActivateController(detailsScreen);
		}
Пример #7
0
		public int SaveTask (Task item)
		{
			if(item.ID != 0)
			{
				base.Update(item);
				return item.ID;
			}
			else
			{
				return base.Insert (item);
			}
		}
		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);

			Console.WriteLine("Locale: "+ Resources.Configuration.Locale); // eg. es_ES
			Console.WriteLine("Locale: "+ Resources.Configuration.Locale.DisplayName); // eg. español (España)


			View titleView = Window.FindViewById(Android.Resource.Id.Title);
			if (titleView != null) {
			  IViewParent parent = titleView.Parent;
			  if (parent != null && (parent is View)) {
			    View parentView = (View)parent;
			    parentView.SetBackgroundColor(Color.Rgb(0x26, 0x75 ,0xFF)); //38, 117 ,255
			  }
			}

			int taskID = Intent.GetIntExtra("TaskID", 0);
			if(taskID > 0) {
				task = null; //HACK:Tasky.BL.Managers.TaskManager.GetTask(taskID);
			}
			
			// set our layout to be the home screen
			SetContentView(Resource.Layout.TaskDetails);
			nameTextEdit = FindViewById<EditText>(Resource.Id.txtName);
			notesTextEdit = FindViewById<EditText>(Resource.Id.txtNotes);
			saveButton = FindViewById<Button>(Resource.Id.btnSave);
			doneCheckbox = FindViewById<CheckBox>(Resource.Id.chkDone);
			
			// find all our controls
			cancelDeleteButton = FindViewById<Button>(Resource.Id.btnCancelDelete);


			// get translations
			var cancelString = Resources.GetText (Resource.String.taskcancel); //getResources().getText(R.string.main_title)
			var deleteString = Resources.GetText (Resource.String.taskdelete);
			// set the cancel delete based on whether or not it's an existing task
			if(cancelDeleteButton != null)
			{ cancelDeleteButton.Text = (task.ID == 0 ? cancelString : deleteString); }
			
			// name
			if(nameTextEdit != null) { nameTextEdit.Text = task.Name; }
			
			// notes
			if(notesTextEdit != null) { notesTextEdit.Text = task.Notes; }
			
			if(doneCheckbox != null) { doneCheckbox.Checked = task.Done; }

			// button clicks 
			cancelDeleteButton.Click += (sender, e) => { CancelDelete(); };
			saveButton.Click += (sender, e) => { Save(); };
		}
        protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);
			
			View titleView = Window.FindViewById(Android.Resource.Id.Title);
			if (titleView != null) {
			  IViewParent parent = titleView.Parent;
			  if (parent != null && (parent is View)) {
			    View parentView = (View)parent;
			    parentView.SetBackgroundColor(Color.Rgb(0x26, 0x75 ,0xFF)); //38, 117 ,255
			  }
			}

			int taskID = Intent.GetIntExtra("TaskID", 0);
			if(taskID > 0) {
                task = TaskyApp.Current.TaskMgr.GetTask(taskID);
            }

            #region Inicia Layout
            // Seta o layout para a tela inicial
			SetContentView(Resource.Layout.TaskDetails);
			nameTextEdit = FindViewById<EditText>(Resource.Id.txtName);
			notesTextEdit = FindViewById<EditText>(Resource.Id.txtNotes);
			saveButton = FindViewById<Button>(Resource.Id.btnSave);
			doneCheckbox = FindViewById<CheckBox>(Resource.Id.chkDone);
			cancelDeleteButton = FindViewById<Button>(Resource.Id.btnCancelDelete);
			speakButton = FindViewById<Button> (Resource.Id.btnSpeak);
            #endregion

            // set the cancel delete based on whether or not it's an existing task
			cancelDeleteButton.Text = (task.ID == 0 ? "Cancel" : "Delete");
			// nome
			nameTextEdit.Text = task.Name; 
			// comentarios
			notesTextEdit.Text = task.Notes; 
			// done
			doneCheckbox.Checked = task.Done; 

			//clicks de botao 
			cancelDeleteButton.Click += (sender, e) => { CancelDelete(); };
			saveButton.Click += (sender, e) => { Save(); };
			speakButton.Click += (sender, e) => {
				Speak(nameTextEdit.Text + ". " + notesTextEdit.Text);
			};
			speaker = new TextToSpeech (this, this);
		}
Пример #10
0
		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);
			
			View titleView = Window.FindViewById(Android.Resource.Id.Title);
			if (titleView != null) {
			  IViewParent parent = titleView.Parent;
			  if (parent != null && (parent is View)) {
			    View parentView = (View)parent;
			    parentView.SetBackgroundColor(Color.Rgb(0x26, 0x75 ,0xFF)); //38, 117 ,255
			  }
			}

			int taskID = Intent.GetIntExtra("TaskID", 0);
			if(taskID > 0) {
				task = Tasky.BL.Managers.TaskManager.GetTask(taskID);
			}
			
			// set our layout to be the home screen
			SetContentView(Resource.Layout.TaskDetails);
			nameTextEdit = FindViewById<EditText>(Resource.Id.txtName);
			notesTextEdit = FindViewById<EditText>(Resource.Id.txtNotes);
			saveButton = FindViewById<Button>(Resource.Id.btnSave);
			doneCheckbox = FindViewById<CheckBox>(Resource.Id.chkDone);
			
			// find all our controls
			cancelDeleteButton = FindViewById<Button>(Resource.Id.btnCancelDelete);
			
			
			// set the cancel delete based on whether or not it's an existing task
			cancelDeleteButton.Text = (task.ID == 0 ? "Cancel" : "Delete");
			
			// name
			nameTextEdit.Text = task.Name;
			
			// notes
			notesTextEdit.Text = task.Notes;

			// done
			doneCheckbox.Checked = task.Done;

			// button clicks 
			cancelDeleteButton.Click += (sender, e) => { CancelDelete(); };
			saveButton.Click += (sender, e) => { Save(); };
		}
		public Task GetItem (int id) 
		{
			var t = new Task ();
            lock (locker) {
				connection = new SqliteConnection ("Data Source=" + path);
				connection.Open ();
				using (var command = connection.CreateCommand ()) {
					command.CommandText = "SELECT [_id], [Name], [Notes], [Done] from [Items] WHERE [_id] = ?";
					command.Parameters.Add (new SqliteParameter (System.Data.DbType.Int32) { Value = id });
					var r = command.ExecuteReader ();
					while (r.Read ()) {
						t = FromReader (r);
						break;
					}
				}
				connection.Close ();
            }
			return t;
		}
		public int SaveItem (Task item) 
		{
			int r;
            lock (locker) {
                if (item.ID != 0) {
					using (connection = new SqliteConnection ("Data Source=" + path)) {
						connection.Open ();
						using (var command = connection.CreateCommand ()) {
							//contents.CommandText = "UPDATE [Items] SET [Name] = '"+item.Name+"', [Notes] = '"+item.Notes+"', [Done] = "+(item.Done?1:0)+" WHERE [_id] = " + item.ID;
							command.CommandText = "UPDATE [Items] SET [Name] = ?, [Notes] = ?, [Done] = ? WHERE [_id] = ?;";
							command.Parameters.Add (new SqliteParameter (System.Data.DbType.String) { Value = item.Name });
							command.Parameters.Add (new SqliteParameter (System.Data.DbType.String) { Value = item.Notes });
							command.Parameters.Add (new SqliteParameter (System.Data.DbType.Int32) { Value = item.Done });
							command.Parameters.Add (new SqliteParameter (System.Data.DbType.Int32) { Value = item.ID });
							r = command.ExecuteNonQuery ();
						}
						connection.Close ();
					}

                    return r;
                } else {
					using (connection = new SqliteConnection ("Data Source=" + path)) {
						connection.Open ();
						using (var command = connection.CreateCommand ()) {
							//contents.CommandText = "INSERT INTO [Items] ([Name], [Notes], [Done]) VALUES ('"+item.Name+"','"+item.Notes+"',"+(item.Done?1:0)+")";
							command.CommandText = "INSERT INTO [Items] ([Name], [Notes], [Done]) VALUES (? ,?, ?)";
							command.Parameters.Add (new SqliteParameter (System.Data.DbType.String) { Value = item.Name });
							command.Parameters.Add (new SqliteParameter (System.Data.DbType.String) { Value = item.Notes });
							command.Parameters.Add (new SqliteParameter (System.Data.DbType.Int32) { Value = item.Done });
							r = command.ExecuteNonQuery ();
						}
						connection.Close ();
					}
                    return r;
                }

            }
		}
Пример #13
0
		public static int SaveTask (Task item)
		{
			return DAL.TaskRepository.SaveTask(item);
		}
Пример #14
0
 public TaskViewModel(Task item)
 {
     Update (item);
 }
Пример #15
0
		public int SaveTask (Task item)
		{
            return repository.SaveTask(item);
		}
Пример #16
0
		public static int SaveTask (Task item)
		{
			return DAL.TaskManager.SaveTask(item);
		}
Пример #17
0
		protected void ShowTaskDetails(Task task)
		{
			this._detailsScreen = new Tasky.Screens.iPhone.TaskDetails.Screen(task);
			this.NavigationController.PushViewController(this._detailsScreen, true);
		}
Пример #18
0
		public TaskClickedEventArgs (Task task) : base ()
		{
			this.Task = task;
		}
		public int SaveTask (Task item)
		{
			return db.SaveItem<Task>(item);
		}
Пример #20
0
		public static int SaveTask (Task item)
		{
			return _me._db.SaveTask(item);
		}
Пример #21
0
		public static int SaveTask (Task item)
		{
			return me.db.SaveItem<Task>(item);
		}
Пример #22
0
		public Screen (Task task) : base ("Screen", null)
		{
			this._task = task;
		}