コード例 #1
0
ファイル: App.xaml.cs プロジェクト: harouny/prebuilt-apps
        /// <summary>
        /// Initializes the singleton application object.  This is the first line of authored code
        /// executed, and as such is the logical equivalent of main() or WinMain().
        /// </summary>
        public App ()
        {
            InitializeComponent ();

            //Create our RootFrame
            RootFrame = new Frame ();

            //Register services for core library
            ServiceRegistrar.Startup ();

            //WinRT specific services
            ServiceContainer.Register<LoginViewModel> ();
            ServiceContainer.Register<AssignmentViewModel> ();
            ServiceContainer.Register<ItemViewModel> ();
            ServiceContainer.Register<LaborViewModel> ();
            ServiceContainer.Register<PhotoViewModel>();
            ServiceContainer.Register<ExpenseViewModel> ();
            ServiceContainer.Register<DocumentViewModel> ();
            ServiceContainer.Register<HistoryViewModel> ();
            ServiceContainer.Register(this);

            loginViewModel = ServiceContainer.Resolve<LoginViewModel> ();
        }
コード例 #2
0
        public LoginPage ()
        {
            this.InitializeComponent ();

            DataContext =
                loginViewModel = ServiceContainer.Resolve<LoginViewModel> ();

            //Generally I would use two-way bindings here, but UpdateSourceTrigger is not available in WinRT
            username.TextChanged += (sender, e) => loginViewModel.Username = username.Text;
            password.PasswordChanged += (sender, e) => loginViewModel.Password = password.Password;

            //Hook up keyboard events
            var inputPane = InputPane.GetForCurrentView ();
            inputPane.Showing += (sender, e) => {
                if (navigatedTo) {
                    keyboardShowingFrame.Value = -e.OccludedRect.Height / 2;
                    keyboardShowing.Begin ();
                }
            };
            inputPane.Hiding += (sender, e) => {
                if (navigatedTo)
                    keyboardHiding.Begin ();
            };
        }