Exemplo n.º 1
0
        /// <summary>
        /// Creates the activity and maps the Xamarin.Forms page to the fragment
        /// </summary>
        /// <param name="savedInstanceState">Saved instance state.</param>
        protected override void OnCreate(Android.OS.Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.xamarin_forms_activity);

            Toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);
            if (Toolbar?.Parent != null)
            {
                AppBar = Toolbar?.Parent as AppBarLayout;
                SetSupportActionBar(Toolbar);
            }

            // register the fragment
            var transaction = SupportFragmentManager.BeginTransaction();

            transaction.Add(Resource.Id.activity_container_fragment, _page.CreateSupportFragment(this));
            transaction.Commit();

            SupportActionBar?.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar?.SetDisplayShowHomeEnabled(true);
            //Toolbar?.SetBackgroundColor(Android.Graphics.Color.White);
            Toolbar?.SetBackgroundColor(Android.Graphics.Color.Transparent);
            // everything else from this point should be managed by the Xamarin.Forms page behind the fragment

            navigationService = SimpleIoc.Default.GetInstance <IViewNavigationService>();
        }
Exemplo n.º 2
0
 public DevicesViewModel(IDeviceService deviceService, IMeasurementService measurementService, IKellerFileService fileService, IViewNavigationService navigationService)
 {
     _deviceService      = deviceService;
     _measurementService = measurementService;
     _fileService        = fileService;
     _navigationService  = navigationService;
     LocalMeasurements   = new ObservableCollection <MeasurementFileFormatHeader>();
     LoadLocal();
 }
Exemplo n.º 3
0
 public VisualizeViewModel(IKellerFileService fileService,
                           IMeasurementService measurementService,
                           IViewNavigationService navigationService,
                           IExportService exportService)
 {
     _fileService        = fileService;
     _measurementService = measurementService;
     _navigationService  = navigationService;
     _exportService      = exportService;
     SelectedRecord.Instance.SelectedRecordChanged += HandleChangedRecord;
 }
Exemplo n.º 4
0
        public MenuPageViewModel(IViewNavigationService navigationService, IMessenger messenger)
        {
            _navigationService = navigationService;
            _messenger         = messenger;
            MenuItems          = new ObservableCollection <HomeMenuItem>();

            Load();

            _messenger?.Register <SelectFirstItemMessage>(this, x =>
            {
                SelectedMenuItem = MenuItems[0];
            });
        }
Exemplo n.º 5
0
        /// <summary>
        /// Initializes a new instance of the MainViewModel class.
        /// </summary>
        public HomeViewModel(IViewNavigationService navigationService)
        {
            this.navigationService = navigationService;

            WelcomeTitle = "Home Page";

            //ImageFileName = "resource://{NativeAndForms.Resources.camera.svg}?assembly={Uri.EscapeUriString(NativeAndForms, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null)}";

            ImageFileName = "resource://NativeAndForms.Resources.camera.svg";

            // ...
            // use for debugging, not in released app code!
            //var assembly = IntrospectionExtensions.GetTypeInfo(typeof(HomeViewModel)).Assembly;
            //foreach (var res in assembly.GetManifestResourceNames())
            //{
            //    System.Diagnostics.Debug.WriteLine("found resource: " + res);
            //}
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Set our view from the "Native" layout resource
            SetContentView(Resource.Layout.NativePage);

            Toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.nativepagetoolbar);
            if (Toolbar?.Parent != null)
            {
                AppBar = Toolbar?.Parent as AppBarLayout;
                SetSupportActionBar(Toolbar);
            }

            SupportActionBar?.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar?.SetDisplayShowHomeEnabled(true);
            Toolbar?.SetBackgroundColor(Android.Graphics.Color.White);

            navigationService = SimpleIoc.Default.GetInstance <IViewNavigationService>();

            // Binding and commanding

            // Binding between the first UILabel and the NativeTitle property on the VM.
            // Keep track of the binding to avoid premature garbage collection
            bindings.Add(
                this.SetBinding(
                    () => Vm.NativeTitle,
                    () => NativeTitle.Text));


            // Retrieve navigation service
            //var nav = (AndroidNavigationService)SimpleIoc.Default.GetInstance<INavigationService>();
            //BackButton.Click += (s, e) => nav.GoBack();

            // Actuate the Command on the VM.
            BackButton.SetCommand(
                "Click",
                Vm.NavigateBackCommand);
        }
Exemplo n.º 7
0
        /// <summary>
        /// Initializes a new instance of the MainViewModel class.
        /// </summary>
        public MainViewModel(IViewNavigationService navigationService)
        {
            this.navigationService = navigationService;

            LoginTitle = "Please enter your login details.";
        }
        public NativeViewModel()
        {
            navigationService = SimpleIoc.Default.GetInstance <IViewNavigationService>();

            NativeTitle = "A Native Page";
        }
Exemplo n.º 9
0
        public MainWindowViewModel(IViewNavigationService viewNavigationService, IEventAggregator eventAggregator, IAsyncLoginService loginService, ILocalizationAppService localizationAppService)
            : base(eventAggregator, localizationAppService)
        {
            _viewNavigationService = viewNavigationService;
            _loginService          = loginService;

            eventAggregator.GetEvent <BusyChangedEvent>().Subscribe(busy =>
            {
                this.Busy = busy;
            });

            eventAggregator.GetEvent <StatusBarMessageChangedEvent>().Subscribe(statusBarMessage =>
            {
                this.StatusBarMessage = statusBarMessage;
            });

            this.StatusBarMessage = new StatusBarMessage
            {
                MessageType = MessageType.None,
                Text        = string.Empty
            };

            _allLanguageOptions = new List <LanguageOption>
            {
                new LanguageOption
                {
                    Title      = "English",
                    IsSelected = true,
                    Language   = "en"
                },
                new LanguageOption
                {
                    Title      = "Italian",
                    IsSelected = false,
                    Language   = "it"
                },
            };

            LanguageOptions = _allLanguageOptions;

            ChangeLanguage(_allLanguageOptions[0].Language);
            SelectedLanguageOption = _allLanguageOptions[0];

            _allMenuOptions = new List <MenuOption>
            {
                new MenuOption
                {
                    Title         = Localize[LanguageKeys.Home],
                    TitleKey      = LanguageKeys.Home,
                    IsSelected    = true,
                    Roles         = string.Empty,
                    AlwaysVisible = true,
                    ViewName      = ViewNames.HOME_VIEW
                },
                new MenuOption
                {
                    Title      = Localize[LanguageKeys.Translation],
                    TitleKey   = LanguageKeys.Translation,
                    IsSelected = false,
                    Roles      = "Admin, UserManager",
                    ViewName   = ViewNames.TRANSLATION_VIEW
                },
                new MenuOption
                {
                    Title      = Localize[LanguageKeys.Merge],
                    TitleKey   = LanguageKeys.Merge,
                    IsSelected = false,
                    Roles      = "Admin",
                    ViewName   = ViewNames.MERGE_VIEW
                }
            };

            MenuOptions        = _allMenuOptions;
            SelectedMenuOption = _allMenuOptions[0];
        }
 public LoginWindowViewModel(IViewNavigationService viewNavigationService, IAsyncLoginService loginService, IEventAggregator eventAggregator, ILocalizationAppService localizationAppService)
     : base(eventAggregator, localizationAppService)
 {
     _viewNavigationService = viewNavigationService;
     _loginService          = loginService;
 }
        public DashboardViewModel(IViewNavigationService navigationService)
        {
            this.navigationService = navigationService;

            DashboardTitle = "Dashboard";
        }
Exemplo n.º 12
0
 /// <summary>
 /// Initializes a new instance of the MainViewModel class.
 /// </summary>
 public MainViewModel(IViewNavigationService navigationService)
 {
     _navigationService = navigationService;
 }