Ejemplo n.º 1
0
        //public bool CanBrowseFileFullName()
        //{
        //    return
        //}

        public void BrowseFileFullName()
        {
            //OpenFileDialog openFileDialog1 = new OpenFileDialog();

            //openFileDialog1.InitialDirectory = "c:\\";
            //openFileDialog1.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*";
            //openFileDialog1.FilterIndex = 2;
            //openFileDialog1.RestoreDirectory = true;
            //openFileDialog1.ShowDialog();

            IFileSystemAccessor accessor  = SelectedApplication.ServiceContainer.Resolve <IFileSystemAccessor>();
            OpenFileViewModel   viewModel = new OpenFileViewModel(accessor);

            if (!string.IsNullOrEmpty(FileFullName))
            {
                viewModel.InitialDirectory = System.IO.Path.GetDirectoryName(FileFullName);
                viewModel.FileName         = System.IO.Path.GetFileName(FileFullName);
            }
            viewModel.Filter = "Executable (*.exe)|*.exe";
            bool?result = _application.ViewModelManager.ShowDialog(viewModel);

            if (result.HasValue && result.Value)
            {
                FileFullName = viewModel.FileName;
            }
        }
Ejemplo n.º 2
0
        public void ConstructorsAndPropertiesTest()
        {
            var open = new OpenFileViewModel("heading");

            Assert.AreEqual("heading", open.Heading);
            Assert.IsNotNull(open.Paths);
            Assert.AreEqual(0, open.Paths.Count);
        }
Ejemplo n.º 3
0
        public ActionResult OpenFile(int id)
        {
            var model = new OpenFileViewModel
            {
                File         = _documentService.GetFileById(id),
                FileVersions = _documentService.GetFileVersionAndCommentsByFileId(id)
            };

            _sessionHelper.CurrentFile = model.File;
            return(View(model));
        }
 private void OnCurrentPathTextBoxKeyDown(object sender, KeyEventArgs e)
 {
     switch (e.Key)
     {
         case Key.Enter:
             TextBox textBox = (TextBox)sender;
             OpenFileViewModel viewModel = (OpenFileViewModel)DataContext;
             viewModel.OpenFileSystemInfo(textBox.Text);
             break;
     }
 }
 private void OnFilesListBoxKeyDown(object sender, KeyEventArgs e)
 {
     OpenFileViewModel viewModel = (OpenFileViewModel)DataContext;
     switch (e.Key)
     {
         case Key.Enter:
             viewModel.OpenSelectedFileSystemInfo();
             break;
         case Key.Back:
             viewModel.OpenParentFileSystemInfo();
             break;
     }
 }
Ejemplo n.º 6
0
        public void Open(params Object[] parameters)
        {
            var context = new OpenFileViewModel();

            context.Title = Messages.OpenWorkspace;
            context.AddFilter(Messages.AllFiles + " (*.*)", "*.*");
            context.AddFilter(Messages.SumericsWorkspace + " (*.sws)", "*.sws");
            context.ShowDialog();

            if (context.Accepted)
            {
                _kernel.LoadWorkspaceAsync(context.SelectedFile.FullName);
            }
        }
 private void OnDataContextChanged(object sender, System.Windows.DependencyPropertyChangedEventArgs e)
 {
     OpenFileViewModel viewModel = e.OldValue as OpenFileViewModel;
     if (viewModel != null)
     {
         viewModel.FileSystemInfosChanged -= OnFileSystemInfosChanged;
     }
     viewModel = e.NewValue as OpenFileViewModel;
     if (viewModel != null)
     {
         viewModel.FileSystemInfosChanged += OnFileSystemInfosChanged;
         viewModel.Initialize();
     }
     ResetFileSystemInfosSelection();
 }
Ejemplo n.º 8
0
 public FindResultViewModel(OpenFileViewModel openFile)
 {
     OpenFile = openFile;
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Creates a new instance of <see cref="OpenFileControl" />.
 /// </summary>
 public OpenFileControl()
 {
     InitializeComponent();
     ViewModel = new OpenFileViewModel(this);
     ViewModel.Subscribe(m => m.FileName, SetFileName);
 }
Ejemplo n.º 10
0
 private void OnFilesListBoxItemMouseDoubleClick(object sender, MouseButtonEventArgs e)
 {
     OpenFileViewModel viewModel = (OpenFileViewModel)DataContext;
     viewModel.OpenSelectedFileSystemInfo();
 }