Ejemplo n.º 1
0
        public LoggingPageViewModel(ILogView logView, IClipboard <ILogView> clipboard, IMailClient <ILogView> mailClient)
        {
            LogView = logView;

            SendCommand = new DelegateCommand(() => mailClient.SendAsync(LogView));
            CopyCommand = new DelegateCommand(() => clipboard.Copy(LogView));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 复制
        /// </summary>
        public bool Copy()
        {
            bool result = clipboard.Copy(instanceCollection);

            instanceCollection.Clear();
            return(result);;
        }
Ejemplo n.º 3
0
        public DatabasePageViewModel(
            INavigator navigator,
            IDatabaseCache unlocker,
            IClipboard <string> clipboard,
            ICredentialProvider credentialProvider,
            INameProvider nameProvider,
            ILauncher launcher,
            IMessageDialogFactory dialogs,
            ILogger log)
        {
            _clipboard          = clipboard;
            _unlocker           = unlocker;
            _navigator          = navigator;
            _credentialProvider = credentialProvider;
            _nameProvider       = nameProvider;
            _launcher           = launcher;
            _dialogs            = dialogs;
            _log = log;

            ItemClickCommand = new DelegateCommand <IKeePassId>(item => GroupClicked(item as IKeePassGroup), item => (item as IKeePassGroup) != null);

            GoToParentCommand = new DelegateCommand <IKeePassGroup>(group =>
            {
                if (_database != null)
                {
                    _navigator.GoToDatabaseView(_database, group);
                }
            });

            CopyCommand = new DelegateCommand <string>(text => _clipboard.Copy(text));

            OpenUrlCommand = new DelegateCommand <IKeePassEntry>(async entry =>
            {
                if (Uri.TryCreate(entry.Url, UriKind.Absolute, out Uri uri))
                {
                    await _launcher.LaunchUriAsync(uri);
                }
            });

            AddEntryCommand = new DelegateCommand(async() =>
            {
                var name = await _nameProvider.GetNameAsync();

                if (!string.IsNullOrEmpty(name))
                {
                    Items.Add(_group.CreateEntry(name));
                }

                NotifyAllCommands();

#if FEATURE_SAVE
                // This is disabled currently due to twsouthwick/KeePassWin 15
            }, () => !_saving);
#else
            }, () => !_activeSearch);