public void OnFileCopied(FileOperationEventArgs a)
 {
     if (FileCopied != null)
     {
         FileCopied(this, a);
     }
 }
Exemplo n.º 2
0
 private void FileManager_OperationAdded(object sender, FileOperationEventArgs e)
 {
     Application.Current.Dispatcher.BeginInvoke((Action)(() =>
     {
         _operationList.Insert(0, new FileOperationViewmodel(e.Operation));
     })
                                                , null);
 }
        private async Task HandleQueryOpenPassphraseEventAsync(FileOperationEventArgs e)
        {
            await QueryDecryptPassphraseAsync(e);

            if (e.Cancel)
            {
                return;
            }
        }
Exemplo n.º 4
0
        private void MainWindow_AddNewTextEvent(object sender, FileOperationEventArgs e)
        {
            string path = e.SelectedFilename;

            vocabulary.LoadFromFile(path);

            mainWindow.Show(new VocabularyInfo {
                Vocabulary = vocabulary, Filename = e.OldFilename
            });
        }
Exemplo n.º 5
0
        private async void viewModel_OpenFile(object sender, FileOperationEventArgs e)
        {
            string path = null;

            System.Windows.Forms.OpenFileDialog openFileDialog = new System.Windows.Forms.OpenFileDialog();
            if (openFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                path = openFileDialog.FileName;
                await _model.LoadFileAsync(path, e.IsDirty);
            }
        }
        private async Task QueryDecryptPassphraseAsync(FileOperationEventArgs e)
        {
            await IdentityViewModel.AskForDecryptPassphrase.ExecuteAsync(e.OpenFileFullName);

            if (IdentityViewModel.LogOnIdentity == LogOnIdentity.Empty)
            {
                e.Cancel = true;
                return;
            }
            e.LogOnIdentity = IdentityViewModel.LogOnIdentity;
        }
Exemplo n.º 7
0
 private void FileManager_OperationAdded(object sender, FileOperationEventArgs e)
 {
     if (e.Operation == null)
     {
         return;
     }
     OnUiThread(() =>
     {
         OperationList.Insert(0, new FileOperationViewmodel(e.Operation));
     });
 }
Exemplo n.º 8
0
        private void HandleQueryDecryptionPassphraseEvent(object sender, FileOperationEventArgs e)
        {
            string passphraseText = AskForDecryptPassphrase();

            if (passphraseText == null)
            {
                e.Cancel = true;
                return;
            }
            e.Passphrase = passphraseText;
        }
Exemplo n.º 9
0
 private void FileManager_OperationCompleted(object sender, FileOperationEventArgs e)
 {
     Application.Current.Dispatcher.BeginInvoke((Action)(() =>
     {
         if (_clearFinished)
         {
             FileOperationViewmodel fovm = _operationList.FirstOrDefault(vm => vm.FileOperation == e.Operation);
             if (fovm != null)
             {
                 _operationList.Remove(fovm);
                 fovm.Dispose();
             }
         }
         InvalidateRequerySuggested();
     }), null);
 }
 private void FileManager_OperationCompleted(object sender, FileOperationEventArgs e)
 {
     if (e.Operation == null)
     {
         return;
     }
     Application.Current?.Dispatcher.BeginInvoke((Action)(() =>
     {
         if (_clearFinished && e.Operation.OperationStatus != FileOperationStatus.Failed)
         {
             FileOperationViewmodel fovm = OperationList.FirstOrDefault(vm => vm.FileOperation == e.Operation); // don't remove failed
             if (fovm != null)
             {
                 OperationList.Remove(fovm);
                 fovm.Dispose();
             }
         }
         InvalidateRequerySuggested();
     }));
 }
Exemplo n.º 11
0
        protected void FireBeforeSavedContentToFile(string fileName)
        {
            if (_beforeSaveContentToFile == null)
            {
                return;
            }

            Delegate[] delegates = _beforeSaveContentToFile.GetInvocationList();
            foreach (BeforeSavedContentToFileDelegate del in delegates)
            {
                try
                {
                    FileOperationEventArgs args = new FileOperationEventArgs();
                    args.FileName = fileName;
                    del.Invoke(this, args);
                }
                catch (Exception ex)
                {
                    HostServicesSingleton.HostServices.MsgService.ErrorMsg(ex, del.Method);
                    HostServicesSingleton.HostServices.MsgService.ShowMessages();
                }
            }
        }
Exemplo n.º 12
0
        private async void viewModel_SaveFile(object sender, FileOperationEventArgs e)
        {
            if (e.IsDirty)
            {
                string path = null;
                if (_model.pathAvailable())
                {
                    path = e.path;
                }
                else
                {
                    System.Windows.Forms.SaveFileDialog saveFileDialog = new System.Windows.Forms.SaveFileDialog();
                    saveFileDialog.Filter           = "txt files (*.txt)|*.txt|All files (*.*)|*.*";
                    saveFileDialog.RestoreDirectory = true;
                    if (saveFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        path = saveFileDialog.FileName;
                    }
                }
                await _model.SaveFileAsync(e.fileContents, e.IsDirty, path);

                _viewModel.IsDirty = false;
            }
        }
Exemplo n.º 13
0
        private void MainWindow_OpenFileEvent(object sender, FileOperationEventArgs e)
        {
            string path = e.SelectedFilename;

            vocabulary.ClearWords();

            try
            {
                Vocabulary restoredVocabulary = BinarySerializer.ReadFromBinaryFile <Vocabulary>(path);
                vocabulary = restoredVocabulary;

                mainWindow.Show(new VocabularyInfo {
                    Vocabulary = vocabulary, Filename = path
                });
            }
            catch (System.IO.IOException ex)
            {
                throw new NotVocabularyException("File access denied", ex);
            }
            catch (System.Runtime.Serialization.SerializationException ex)
            {
                throw new NotVocabularyException("File is not a vocabulary", ex);
            }
        }
Exemplo n.º 14
0
 private void _contentPersister_BeforeSavedContentToFile(object sender, FileOperationEventArgs args)
 {
     FireBeforeSaveContentToFile(args.FileName);
 }
 protected virtual void OnToggleEncryptionUpgradeMode(FileOperationEventArgs e)
 {
     ToggleEncryptionUpgradeMode?.Invoke(this, e);
 }
Exemplo n.º 16
0
 protected virtual void OnFileOperationCompleted(FileOperationEventArgs e)
 {
     FileOperationCompleted?.Invoke(this, e);
 }
 private Task HandleQueryDecryptionPassphraseEventAsync(FileOperationEventArgs e)
 {
     return(QueryDecryptPassphraseAsync(e));
 }
Exemplo n.º 18
0
        private void MainWindow_SaveFileAsEvent(object sender, FileOperationEventArgs e)
        {
            string path = e.SelectedFilename;

            BinarySerializer.WriteToBinaryFile(path, vocabulary);
        }
Exemplo n.º 19
0
 private void _viewModel_NewFile(object sender, FileOperationEventArgs e)
 {
     _model.NewFile();
 }
 public void model_FileOpened(object sender, FileOperationEventArgs e)
 {
     IsDirty     = false;
     CurrentText = e.fileContents;
 }
Exemplo n.º 21
0
 private void _queue_OperationCompleted(object sender, FileOperationEventArgs e)
 {
     OperationCompleted?.Invoke(this, e);
 }
 public void model_FileSaved(object sender, FileOperationEventArgs e)
 {
     IsDirty = false;
 }
 protected virtual void OnFirstLegacyOpen(FileOperationEventArgs e)
 {
     FirstLegacyOpen?.Invoke(this, e);
 }
Exemplo n.º 24
0
 private void OnFileOperationCompleted(FileOperationEventArgs e)
 {
     FileOperationCompleted?.Invoke(this, e);
 }
Exemplo n.º 25
0
 public async void ViewModel_FileOpened(object sender, FileOperationEventArgs e)
 {
     Debug.WriteLine("Megnyitva");
     await _model.LoadFileAsync(e.Url);
 }
Exemplo n.º 26
0
 public async void ViewModel_FileSaved(object sender, FileOperationEventArgs e)
 {
     Debug.WriteLine("Mentés");
     await _model.SaveFileAsync(e.Content, e.Url);
 }
Exemplo n.º 27
0
 private void DokanInterface_FileOperationStarted(object sender, FileOperationEventArgs e)
 {
     OnFileOperationStarted(e);
 }
Exemplo n.º 28
0
 void _textEditor_BeforeSaveContentToFile(object sender, FileOperationEventArgs args)
 {
     AddEvent("TextEditor.BeforeSaveContentToFile. FileName = " + args.FileName);
 }