예제 #1
0
      /// <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()
      {
          // Setup DI
          IServiceCollection serviceCollection = new ServiceCollection();

          serviceCollection.AddApplication();
          serviceCollection.AddInfrastructureCommon();
          serviceCollection.AddInfrastructureKeePass();
          serviceCollection.AddInfrastructureUwp();
          serviceCollection.AddWin81App();
          Services = serviceCollection.BuildServiceProvider();

          _mediator     = Services.GetService <IMediator>();
          _resource     = Services.GetService <IResourceProxy>();
          _settings     = Services.GetService <ISettingsProxy>();
          _navigation   = Services.GetService <INavigationService>();
          _notification = Services.GetService <INotificationService>();
          _log          = Services.GetService <ILogger>();
          _hockey       = Services.GetService <IHockeyClient>();
          _file         = Services.GetService <IFileProxy>();
          _messenger    = Services.GetService <IMessenger>();

          InitializeComponent();
          Suspending         += OnSuspending;
          Resuming           += OnResuming;
          UnhandledException += OnUnhandledException;

          _messenger.Register <SaveErrorMessage>(this, async message => await HandleSaveError(message));
      }
예제 #2
0
        public EntryDetailVm(IMediator mediator, INavigationService navigation, IResourceProxy resource, IDialogService dialog, INotificationService notification, IFileProxy file, ICryptographyClient cryptography, IDateTime dateTime)
        {
            _mediator     = mediator;
            _navigation   = navigation;
            _resource     = resource;
            _dialog       = dialog;
            _notification = notification;
            _file         = file;
            _cryptography = cryptography;
            _dateTime     = dateTime;

            SaveCommand             = new RelayCommand(async() => await SaveChanges(), () => Database.IsDirty);
            MoveCommand             = new RelayCommand <string>(async destination => await Move(destination), destination => Parent != null && !string.IsNullOrEmpty(destination) && destination != Parent.Id);
            RestoreCommand          = new RelayCommand(async() => await RestoreHistory());
            DeleteCommand           = new RelayCommand(async() => await AskForDelete());
            AddAdditionalField      = new RelayCommand(AddField, () => IsCurrentEntry);
            DeleteAdditionalField   = new RelayCommand <EntryFieldVm>(async field => await DeleteField(field), field => field != null && IsCurrentEntry);
            OpenAttachmentCommand   = new RelayCommand <Attachment>(async attachment => await OpenAttachment(attachment));
            AddAttachmentCommand    = new RelayCommand(async() => await AddAttachment(), () => IsCurrentEntry);
            DeleteAttachmentCommand = new RelayCommand <Attachment>(async attachment => await DeleteAttachment(attachment), _ => IsCurrentEntry);
            SetCurrentEntryCommand  = new RelayCommand <EntryVm>(SetCurrentEntry, entry => entry != null);

            MessengerInstance.Register <DatabaseSavedMessage>(this, _ => SaveCommand.RaiseCanExecuteChanged());
            MessengerInstance.Register <EntryFieldValueChangedMessage>(this, async message => await SetFieldValue(message.FieldName, message.FieldValue, message.IsProtected));
            MessengerInstance.Register <EntryFieldNameChangedMessage>(this, async message => await UpdateFieldName(message.OldName, message.NewName, message.Value, message.IsProtected));
            MessengerInstance.Register <PasswordGeneratedMessage>(this, message => Password = message.Password);
        }
예제 #3
0
        /// <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()
        {
            // Setup DI
            IServiceCollection serviceCollection = new ServiceCollection();

            serviceCollection.AddApplication();
            serviceCollection.AddInfrastructureCommon();
            serviceCollection.AddInfrastructureKeePass();
            serviceCollection.AddInfrastructureUwp();
            serviceCollection.AddWin10App();
            Services = serviceCollection.BuildServiceProvider();

            _mediator     = Services.GetService <IMediator>();
            _resource     = Services.GetService <IResourceProxy>();
            _settings     = Services.GetService <ISettingsProxy>();
            _navigation   = Services.GetService <INavigationService>();
            _dialog       = Services.GetService <IDialogService>();
            _notification = Services.GetService <INotificationService>();

#if DEBUG
            AppCenter.Start("029ab91d-1e4b-4d4d-9661-5d438dd671a5",
                            typeof(Analytics), typeof(Crashes));
#else
            AppCenter.Start("79d23520-a486-4f63-af81-8d90bf4e1bea", typeof(Analytics));
#endif

            InitializeComponent();
            Suspending         += OnSuspending;
            Resuming           += OnResuming;
            UnhandledException += OnUnhandledException;
        }
예제 #4
0
        public CredentialsVm(IMediator mediator, IResourceProxy resource, INotificationService notification)
        {
            _mediator     = mediator;
            _resource     = resource;
            _notification = notification;

            MessengerInstance.Register <CredentialsSetMessage>(this, async message => await UpdateDatabaseCredentials(message));
        }
예제 #5
0
        public SettingsVm(IMediator mediator, IResourceProxy resource)
        {
            var database  = mediator.Send(new GetDatabaseQuery()).GetAwaiter().GetResult();
            var menuItems = new ObservableCollection <ListMenuItemVm>
            {
                new ListMenuItemVm
                {
                    Title      = resource.GetResourceValue("SettingsMenuItemNew"),
                    Group      = resource.GetResourceValue("SettingsMenuGroupApplication"),
                    SymbolIcon = Symbol.Add,
                    PageType   = typeof(SettingsNewDatabasePage),
                    IsSelected = true
                },
                new ListMenuItemVm
                {
                    Title      = resource.GetResourceValue("SettingsMenuItemGeneral"),
                    Group      = resource.GetResourceValue("SettingsMenuGroupApplication"),
                    SymbolIcon = Symbol.Setting,
                    PageType   = typeof(SettingsGeneralPage)
                },
                new ListMenuItemVm
                {
                    Title      = resource.GetResourceValue("SettingsMenuItemSecurity"),
                    Group      = resource.GetResourceValue("SettingsMenuGroupDatabase"),
                    SymbolIcon = Symbol.Permissions,
                    PageType   = typeof(SettingsSecurityPage),
                    IsEnabled  = database.IsOpen
                },
                new ListMenuItemVm
                {
                    Title      = resource.GetResourceValue("SettingsMenuItemHistory"),
                    Group      = resource.GetResourceValue("SettingsMenuGroupDatabase"),
                    SymbolIcon = Symbol.Undo,
                    PageType   = typeof(SettingsHistoryPage),
                    IsEnabled  = database.IsOpen
                },
                new ListMenuItemVm
                {
                    Title      = resource.GetResourceValue("SettingsMenuItemRecycleBin"),
                    Group      = resource.GetResourceValue("SettingsMenuGroupDatabase"),
                    SymbolIcon = Symbol.Delete,
                    PageType   = typeof(SettingsRecycleBinPage),
                    IsEnabled  = database.IsOpen
                },
                new ListMenuItemVm
                {
                    Title      = resource.GetResourceValue("SettingsMenuItemCredentials"),
                    Group      = resource.GetResourceValue("SettingsMenuGroupDatabase"),
                    SymbolIcon = Symbol.Account,
                    PageType   = typeof(SettingsCredentialsPage),
                    IsEnabled  = database.IsOpen
                }
            };

            SelectedItem = menuItems.FirstOrDefault(m => m.IsSelected);

            MenuItems = from item in menuItems group item by item.Group into grp orderby grp.Key select grp;
        }
예제 #6
0
 public OpenDatabaseControlVm(IMediator mediator, IResourceProxy resource, INotificationService notification, IFileProxy file, IDialogService dialog)
 {
     _mediator           = mediator;
     _resource           = resource;
     _notification       = notification;
     _file               = file;
     _dialog             = dialog;
     OpenKeyFileCommand  = new RelayCommand(async() => await OpenKeyFile());
     OpenDatabaseCommand = new RelayCommand <string>(async databaseFilePath => await TryOpenDatabase(databaseFilePath), _ => IsValid);
     _keyFileText        = _resource.GetResourceValue("CompositeKeyDefaultKeyFile");
 }
예제 #7
0
        public NewVm(IMediator mediator, ISettingsProxy settings, INavigationService navigation, IFileProxy file, IResourceProxy resource) : base(file)
        {
            _mediator   = mediator;
            _settings   = settings;
            _navigation = navigation;
            _file       = file;
            _resource   = resource;

            CreateDatabaseFileCommand = new RelayCommand(async() => await CreateDatabaseFile());

            MessengerInstance.Register <CredentialsSetMessage>(this, async m => await TryCreateDatabase(m));
        }
예제 #8
0
        public SaveVm(IMediator mediator, INavigationService navigation, IFileProxy file, IResourceProxy resource)
        {
            _mediator   = mediator;
            _navigation = navigation;
            _file       = file;
            _resource   = resource;

            SaveAsCommand = new RelayCommand(async() => await SaveAs());
            SaveCommand   = new RelayCommand(async() => await Save(), () => IsSaveEnabled);
            CloseCommand  = new RelayCommand(async() => await Close());

            MessengerInstance.Register <DatabaseSavedMessage>(this, _ => SaveCommand.RaiseCanExecuteChanged());
        }
예제 #9
0
        public MainVm(
            IMediator mediator,
            IRecentProxy recent,
            IResourceProxy resource,
            IDialogService dialog,
            INotificationService notification,
            INavigationService navigation)
        {
            _mediator     = mediator;
            _recent       = recent;
            _resource     = resource;
            _dialog       = dialog;
            _notification = notification;
            _navigation   = navigation;

            MessengerInstance.Register <DatabaseOpenedMessage>(this, NavigateToPage);
            MessengerInstance.Register <DatabaseAlreadyOpenedMessage>(this, async message => await DisplaySaveConfirmation(message));
        }
예제 #10
0
        public SetCredentialsVm(IMediator mediator, IResourceProxy resource, IFileProxy file)
        {
            _mediator = mediator;
            _resource = resource;
            _file     = file;

            OpenKeyFileCommand         = new RelayCommand(async() => await OpenKeyFile(), () => HasKeyFile);
            CreateKeyFileCommand       = new RelayCommand(async() => await CreateKeyFile(), () => HasKeyFile);
            GenerateCredentialsCommand = new RelayCommand(GenerateCredentials, () => IsValid);

            _keyFileText = resource.GetResourceValue("CompositeKeyDefaultKeyFile");

            MessengerInstance.Register <PasswordGeneratedMessage>(this, message =>
            {
                Password        = message.Password;
                ConfirmPassword = message.Password;
            });
        }
예제 #11
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            ResourceProxy = new DefaultResourceProxyImpl(inflater.Context.ApplicationContext);
            View view = inflater.Inflate(Resource.Layout.OSMMap, container, false);

            mapView = view.FindViewById <MapView>(Resource.Id.map);
            mapView.SetTileSource(TileSourceFactory.DefaultTileSource);
            mapView.SetBuiltInZoomControls(true);
            mapView.SetMultiTouchControls(true);
            var mapController = mapView.Controller;

            mapController.SetZoom(25);

            var centreOfMap = new GeoPoint(50.54, 19.49);

            mapController.SetCenter(centreOfMap);

            return(view);
        }
예제 #12
0
        public GroupDetailVm(IMediator mediator, IResourceProxy resource, INavigationService navigation, IDialogService dialog, INotificationService notification)
        {
            _mediator     = mediator;
            _resource     = resource;
            _navigation   = navigation;
            _dialog       = dialog;
            _notification = notification;

            SaveCommand        = new RelayCommand(async() => await SaveChanges(), () => Database.IsDirty);
            SortEntriesCommand = new RelayCommand(async() => await SortEntriesAsync(), () => IsEditMode);
            SortGroupsCommand  = new RelayCommand(async() => await SortGroupsAsync(), () => IsEditMode);
            MoveCommand        = new RelayCommand <string>(async destination => await Move(destination), destination => IsNotRoot && !string.IsNullOrEmpty(destination) && destination != Id);
            CreateEntryCommand = new RelayCommand(async() => await AddNewEntry(), () => !IsInRecycleBin && Database.RecycleBinId != Id);
            CreateGroupCommand = new RelayCommand <string>(async newGroupName => await AddNewGroup(newGroupName), _ => !IsInRecycleBin && Database.RecycleBinId != Id);
            DeleteCommand      = new RelayCommand(async() => await AskForDelete(), () => IsNotRoot);
            GoBackCommand      = new RelayCommand(() => _navigation.GoBack());
            GoToParentCommand  = new RelayCommand(() => GoToGroup(Parent.Id), () => Parent != null);
            GoToGroupCommand   = new RelayCommand <GroupVm>(group => GoToGroup(group.Id), group => group != null);
            GoToEntryCommand   = new RelayCommand <EntryVm>(entry => GoToEntry(entry.Id), entry => entry != null);
            DeleteEntryCommand = new RelayCommand <EntryVm>(async entry => await AskForDeleteEntry(entry), entry => entry != null);

            MessengerInstance.Register <DatabaseSavedMessage>(this, _ => SaveCommand.RaiseCanExecuteChanged());
        }
예제 #13
0
 public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
 {
     _resourceProxy = new ResourceProxyImpl(inflater.Context.ApplicationContext);
     _mapView = new MapView(inflater.Context, 256, _resourceProxy);
     return _mapView;
 }
 public GeoPositionOverlay(IResourceProxy p0) : base(p0)
 {
 }
 public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
 {
     ResourceProxy = new ResourceProxyImpl(inflater.Context.ApplicationContext);
     MapView       = new MapView(inflater.Context, 256, ResourceProxy);
     return(MapView);
 }
예제 #16
0
 public BitmapOverlay(IResourceProxy p0) : base(p0)
 {
 }