public DocumentSignerViewModel()
 {
     Jobs = new ObservableCollection<SignJobViewModel>();
     ActiveCert = !String.IsNullOrEmpty(LastCertSerial)
                     ? CertUtil.GetBySerial(LastCertSerial) ?? CertUtil.GetAll(x => x, requirePrivateKey:true).FirstOrDefault()
                     : CertUtil.GetAll(x => x, requirePrivateKey: true).FirstOrDefault();
     ShowCertsDialog = new RelayCommand(x => AskUserForCert());
     ShowActiveCert = new RelayCommand(x => DisplayActiveCert(), x => ActiveCert != null);
 }
        public SignJobViewModel(string inputFile)
        {
            if(String.IsNullOrEmpty(inputFile)
                || !File.Exists(inputFile)
                || !SupportedExts.Any(validExt=>inputFile.EndsWith(validExt,StringComparison.InvariantCultureIgnoreCase)))
            {
                State = SignJobState.Invalid;
                return;
            }

            InputFile = inputFile;
            InputFileName = Path.GetFileName(inputFile);

            var ext = Path.GetExtension(inputFile);
            FileType = ext;

            //TODO: may have to try catch this, and use a backup icon on failure
            Icon = Utils.GetBitmapSourceIconFromFile(inputFile);
            OpenOutput = new RelayCommand(
                    o => Process.Start(new ProcessStartInfo { FileName = OutputFile, UseShellExecute = true }));
            OpenInput = new RelayCommand(o => Process.Start(new ProcessStartInfo { FileName = InputFile, UseShellExecute = true }));

            State = SignJobState.Pending;
        }
 public DocumentSignerViewModel()
 {
     ReloadCerts();
     Reload = new RelayCommand(x => ReloadCerts());
     Jobs = new ObservableCollection<SignJobViewModel>();
 }