コード例 #1
0
        public static async void ShowEditGroupDialog(IProfileViewModel viewModel, IDialogCoordinator dialogCoordinator, string group)
        {
            var customDialog = new CustomDialog
            {
                Title = Resources.Localization.Strings.EditGroup
            };

            var editGroupViewModel = new GroupViewModel(instance =>
            {
                dialogCoordinator.HideMetroDialogAsync(viewModel, customDialog);
                viewModel.OnProfileDialogClose();

                RenameGroup(instance.OldGroup, instance.Group);

                viewModel.RefreshProfiles();
            }, instance =>
            {
                dialogCoordinator.HideMetroDialogAsync(viewModel, customDialog);
                viewModel.OnProfileDialogClose();
            }, group, GetGroups());

            customDialog.Content = new GroupDialog
            {
                DataContext = editGroupViewModel
            };

            viewModel.OnProfileDialogOpen();
            await dialogCoordinator.ShowMetroDialogAsync(viewModel, customDialog);
        }
コード例 #2
0
        public static async void ShowDeleteProfileDialog(IProfileViewModel viewModel, IDialogCoordinator dialogCoordinator, ProfileInfo selectedProfile)
        {
            var customDialog = new CustomDialog
            {
                Title = Resources.Localization.Strings.DeleteProfile
            };

            var confirmRemoveViewModel = new ConfirmRemoveViewModel(instance =>
            {
                dialogCoordinator.HideMetroDialogAsync(viewModel, customDialog);
                viewModel.OnProfileDialogClose();

                RemoveProfile(selectedProfile);
            }, instance =>
            {
                dialogCoordinator.HideMetroDialogAsync(viewModel, customDialog);
                viewModel.OnProfileDialogClose();
            }, Resources.Localization.Strings.DeleteProfileMessage);

            customDialog.Content = new ConfirmRemoveDialog
            {
                DataContext = confirmRemoveViewModel
            };

            viewModel.OnProfileDialogOpen();
            await dialogCoordinator.ShowMetroDialogAsync(viewModel, customDialog);
        }
コード例 #3
0
        public static async void ShowCopyAsProfileDialog(IProfileViewModel viewModel, IDialogCoordinator dialogCoordinator, ProfileInfo selectedProfile)
        {
            var customDialog = new CustomDialog
            {
                Title = Resources.Localization.Strings.CopyProfile
            };

            var profileViewModel = new ProfileViewModel(instance =>
            {
                dialogCoordinator.HideMetroDialogAsync(viewModel, customDialog);
                viewModel.OnProfileDialogClose();

                AddProfile(instance);
            }, instance =>
            {
                dialogCoordinator.HideMetroDialogAsync(viewModel, customDialog);
                viewModel.OnProfileDialogClose();
            }, GetGroups(), ProfileEditMode.Copy, selectedProfile);

            customDialog.Content = new ProfileDialog
            {
                DataContext = profileViewModel
            };

            viewModel.OnProfileDialogOpen();
            await dialogCoordinator.ShowMetroDialogAsync(viewModel, customDialog);
        }
コード例 #4
0
        public ProfilePage()
        {
            InitializeComponent();

            viewModel      = (IProfileViewModel)Splat.Locator.Current.GetService(typeof(IProfileViewModel));
            BindingContext = viewModel;
        }
コード例 #5
0
 private void LoadCurrentObject(IProfileViewModel profileViewModel)
 {
     FirstName         = profileViewModel.FirstName;
     LastName          = profileViewModel.LastName;
     EmailAddress      = profileViewModel.EmailAddress;
     AboutMe           = profileViewModel.AboutMe;
     ProfilePicDataUrl = profileViewModel.ProfilePicDataUrl;
     //add more fields
 }