示例#1
0
        /// <summary>
        /// This button will pop a new user info dialog.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void ProjectEditButton_Tapped(object sender, Windows.UI.Xaml.Input.TappedRoutedEventArgs e)
        {
            //Update settings with new selected project
            if (_projectCollection != null && _selectedProjectIndex != -1 && _projectCollection.Count > 0)
            {
                //Get selected project
                FieldBooks selectedProject = _projectCollection[_selectedProjectIndex];

                //Build connection file
                SQLiteConnection selectedProjectConnection = new SQLiteConnection(new SQLitePlatformWinRT(), selectedProject.ProjectDBPath);

                //Get metadata
                List <object> inMeta = accessData.ReadTableFromDBConnection(metadataModel.GetType(), null, selectedProjectConnection);

                if (inMeta != null && inMeta.Count > 0)
                {
                    //Show UserInfoPart window as a modal dialog
                    WindowWrapper.Current().Dispatcher.Dispatch(() =>
                    {
                        selectedProject.metadataForProject = inMeta[0] as Metadata;

                        var modal                   = Window.Current.Content as ModalDialog;
                        var view                    = modal.ModalContent as Views.FieldBookDialog;
                        modal.ModalContent          = view = new Views.FieldBookDialog(selectedProject);
                        view.ViewModel.projectEdit += ViewModel_projectEdit;
                        modal.IsModal               = true;
                    });
                }
            }
        }
示例#2
0
        /// <summary>
        /// From a given field book, will open a user info dialog
        /// </summary>
        /// <param name="stationReport"></param>
        public void PopUserInfo(FieldBooks projectDetails)
        {
            var modal = Window.Current.Content as ModalDialog;
            var view  = modal.ModalContent as Views.FieldBookDialog;

            view = new Views.FieldBookDialog(projectDetails);
            //view.Tag = ReportDetailedStation;
            modal.ModalContent = view;
            modal.IsModal      = true;
        }
示例#3
0
        /// <summary>
        /// will pop a new user info dialog.
        /// </summary>
        public async Task AddNewProject()
        {
            //Init a new project if nothing has been done.
            if (_projectCollection.Count == 0)
            {
                bool dbExists = accessData.DoesDatabaseExists();

                if (!dbExists || localSetting.GetSettingValue(Dictionaries.DatabaseLiterals.FieldUserInfoID) == null)
                {
                    //Wipe application setting of user info before iniating a new user dialog
                    localSetting.WipeUserInfoSettings();

                    await accessData.CreateDatabaseFromResource();

                    //Show UserInfoPart window as a modal dialog
                    WindowWrapper.Current().Dispatcher.Dispatch(() =>
                    {
                        var modal          = Window.Current.Content as ModalDialog;
                        var view           = modal.ModalContent as Views.FieldBookDialog;
                        modal.ModalContent = view = new Views.FieldBookDialog(null, true);
                        modal.IsModal      = true;
                    });
                }

                //Send event about missing field books.
                fieldBooksUpdate?.Invoke(this, true);
            }
            else
            {
                //Show UserInfoPart window as a modal dialog
                WindowWrapper.Current().Dispatcher.Dispatch(() =>
                {
                    var modal          = Window.Current.Content as ModalDialog;
                    var view           = modal.ModalContent as Views.FieldBookDialog;
                    modal.ModalContent = view = new Views.FieldBookDialog(null);
                    modal.IsModal      = true;
                });
            }
        }