Exemplo n.º 1
0
		public App (FormsApplicationActivity a)
		{	
			if (!ProjectCodeManager.GetProjectCodes ().Any () || !JobManager.GetJobs ().Any ()) {
				MainPage = new LoadingTab (a);
				//return load;
			}	
			var activeEntry = TimeManager.GetActiveTimeEntry ();
			if (activeEntry != null) {
				new Thread (() => Forms.Context.StartService (new Intent (a, typeof(StartLocationTimer)))).Start ();
			}
			MainPage = new NavigationPage (new MainContent (a));
		}
Exemplo n.º 2
0
 /// <summary>
 /// Used for registration with dependency service
 /// </summary>
 internal static void Init(FormsApplicationActivity activity) { AppInformer.Activity = activity; }
Exemplo n.º 3
0
        public MainContent(FormsApplicationActivity a)
        {
            act = a;
            Title = "ETC TimeApp version " + act.Resources.GetString (ETCTimeApp.Android.Resource.String.version);
            string imei = DeviceHelper.GetMyIMEI ();

            Billable = new BillableTab ();
            Billable.Title = "Billable Time";
            NonBillable = new NonBillableTab ();
            NonBillable.Title = "Non Billable Time";
            var now = DateTime.Now;
            var entries = TimeManager.GetTimeEntries ().Where (x => x.Stop != null && x.Start > now.AddDays (-15))
                .OrderByDescending(x => x.Start).ToArray();
            Entries = new EntriesTab (entries);
            Entries.Title = "History";
            Children.Add (Billable);
            Children.Add (NonBillable);
            Children.Add (Entries);

            var activeEntry = TimeManager.GetActiveTimeEntry ();
            if (activeEntry != null) {
                var timer = new Intent (a, typeof(StartLocationTimer));
                new Thread (() => Forms.Context.StartService (timer)).Start ();
            }

            ViewModel = new ActivityPageViewModel ();
            BindingContext = ViewModel;
            var activityIndicator = new ActivityIndicator {
                Color = Color.Black,
            };
            activityIndicator.SetBinding (ActivityIndicator.IsVisibleProperty, "IsBusy");
            activityIndicator.SetBinding (ActivityIndicator.IsRunningProperty, "IsBusy");

            var menu = new ToolbarItem ();
            menu.Text = "";
            menu.Order = ToolbarItemOrder.Default;

            var hours = new ToolbarItem ();
            hours.Text = "Hours";
            hours.Order = ToolbarItemOrder.Primary;
            hours.Clicked += GetHours;

            var sync = new ToolbarItem ();
            sync.Text = "Sync";
            sync.Order = ToolbarItemOrder.Primary;
            sync.Clicked += CallSync;

            var consolidate = new ToolbarItem ();
            consolidate.Text = "Consolidate";
            consolidate.Order = ToolbarItemOrder.Primary;
            consolidate.Clicked += CallConsolidate;

            ToolbarItems.Add (menu);
            ToolbarItems.Add (hours);
            ToolbarItems.Add (sync);
            ToolbarItems.Add (consolidate);

            //			#region testing
            //			var mock = new ToolbarItem ();
            //			mock.Text = "Mock Entries";
            //			mock.Order = ToolbarItemOrder.Secondary;
            //			mock.Clicked += MockEntries;
            //
            //			var del = new ToolbarItem ();
            //			del.Text = "Delete Entries";
            //			del.Order = ToolbarItemOrder.Secondary;
            //			del.Clicked += DeleteEntries;
            //			ToolbarItems.Add (mock);
            //			ToolbarItems.Add (del);
            //			#endregion
        }