public override void Modify(CharacterViewModel model) { OpenFileDialog opfd = new OpenFileDialog { Filter = "PNG Files (*.png)|*.png", CheckFileExists = true, InitialDirectory = Core.EditSaveDir, Multiselect = false, }; opfd.CustomPlaces.Add(new FileDialogCustomPlace(Core.EditSaveDir)); if (!opfd.ShowDialog() .Value) { return; } CharacterFile inC; using (Stream s = File.OpenRead(opfd.FileName)) inC = CharacterFile.Load(s); if (inC == null) { return; } ImportWindow iWnd = new ImportWindow { Imported = inC, Target = model.Character }; iWnd.ShowDialog(); }
public void Show(CommonBase ViewModel) { ImportWindow myWin = new ImportWindow(); myWin.DataContext = ViewModel; ((ImportViewModel)ViewModel).ClosingRequest += (sender, e) => myWin.Close(); myWin.Owner = Application.Current.MainWindow; myWin.ShowDialog(); }
// MARK: Add Multiple Videos function private void AddNewVideos(string resultingPath, bool isAnalysisVid) //logic for adding a training/analysis video { //open a file dialog to let the user choose which video to add OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Multiselect = true; openFileDialog.Title = "Select videos"; if (openFileDialog.ShowDialog() == true) { bool syncUI = false; foreach (var fullPath in openFileDialog.FileNames) { string[] temp = fullPath.Split('\\'); string videoName = temp[temp.Length - 1]; if (videoName.ToLower().EndsWith(".avi") || videoName.ToLower().EndsWith(".mp4") || videoName.ToLower().EndsWith(".wmv") || videoName.ToLower().EndsWith(".mov")) { if (!FileSystemUtils.NameAlreadyInDir(FileSystemUtils.ExtendPath(FileSystemUtils.GetParentFolder(CurrentProject.ConfigPath), resultingPath), FileSystemUtils.GetFileNameWithExtension(fullPath))) { if (FileSystemUtils.FileNameOk(fullPath)) { ImportWindow window = new ImportWindow(fullPath, CurrentProject.ConfigPath, isAnalysisVid, EnvDirectory, EnvName, Drive, ProgramFolder); if (window.ShowDialog() == true) { syncUI = true; } } else { MessageBox.Show(fullPath + "\n\nFile names must be 25 characters or less, with only alphanumeric characters, dashes, and underscores allowed.", "Invalid Name", MessageBoxButton.OK, MessageBoxImage.Error); } } else { MessageBox.Show("Video with a similar or an identical name as \"" + videoName + "\" has already been added. Please rename your new video.", "Name Already Taken", MessageBoxButton.OK, MessageBoxImage.Error); } } else { MessageBox.Show("\"" + videoName + "\" cannot be added. Your video format is not supported.\n (Supported formats include: .avi, .mp4, .wmv, .mov)", "Unsupported Action", MessageBoxButton.OK, MessageBoxImage.Error); } } if (syncUI) { SyncUI(); } } EnableInteraction(); }
public ImportViewModel(OptionViewModel options, MainWindow parent) { Options = options; OpenImportTable(); View = new ImportWindow(this) { Top = parent.Top + 20, Left = parent.Left + 20 }; View.ShowDialog(); }
private void buttonImport_Click(object sender, RoutedEventArgs e) { ImportWindow importWindow = new ImportWindow(); if (importWindow.ShowDialog() == false) { if (importWindow.dataWasImported) { if (ValidationService.TableIsValid(importWindow.mainTable)) { mainDataGrid = DataTableService.InsertDataToGrid(importWindow.mainTable, mainDataGrid); mainTable = importWindow.mainTable; } else { MessageBox.Show("W pliku występują braki danych!", "Błąd", MessageBoxButton.OK, MessageBoxImage.Error); } } } }
private void PushImportPage(object obj) { List <ObjectItemTypeDefinationModel> selectedData = GetAllSelectedChildrens(Tree); MaskDescriptionModel mappedDesc = new MaskDescriptionModel(); List <ObjectitemTabTree> Tabmodel = new List <ObjectitemTabTree>(); List <ObjectitemToDragToTree> attModel = new List <ObjectitemToDragToTree>(); var definations = GetAllAttribute(); definations.ForEach(x => { if (x.Name != "Project System Templates") { attModel.Add(new ObjectitemToDragToTree(x)); } }); //attModel.Add(new ObjectitemToDragToTree(definations)); foreach (var item in selectedData) { mappedDesc.FolderName = item.Name; List <MaskDescriptionModel> ListmappedDesc = new List <MaskDescriptionModel>(); foreach (var types in item.FolderChildren) { var maskDesc = GetMaskDescription(types.Source.Id); MaskDescriptionModel childMapping = new MaskDescriptionModel(); childMapping.TreeView = MapMaskDescriptionModel(maskDesc); childMapping.Typename = types.Name; ListmappedDesc.Add(childMapping); } mappedDesc.TreeView = ListmappedDesc; Tabmodel.Add(new ObjectitemTabTree(mappedDesc)); } if (selectedData.Count == 0) { System.Windows.MessageBox.Show("Please Select Some Data!!!"); } else { ImportWindow importPage = new ImportWindow(); importPage.DataContext = new ImportWindowViewModel(this.myApplication, Tabmodel, attModel); importPage.ShowDialog(); } }
private void importBtn_Click(object sender, RoutedEventArgs e) { importWnd.OnOpen(); importWnd.ShowDialog(); }
public MainViewModel() { ImportWindow = new RelayCommand <Window>((p) => { return(true); }, (p) => { if (_UserIDRole != 1) { LoadDialogErrorNotPermission(); return; } ImportWindow wd = new ImportWindow(); wd.ShowDialog(); }); SellWindow = new RelayCommand <Window>((p) => { return(true); }, (p) => { SellWindow wd = new SellWindow(); wd.ShowDialog(); }); CustomerWindow = new RelayCommand <Window>((p) => { return(true); }, (p) => { if (_UserIDRole != 1) { LoadDialogErrorNotPermission(); return; } CustomerWindow wd = new CustomerWindow(); wd.ShowDialog(); }); ProductWindow = new RelayCommand <Window>((p) => { return(true); }, (p) => { if (_UserIDRole != 1) { LoadDialogErrorNotPermission(); return; } ProductWindow wd = new ProductWindow(); wd.ShowDialog(); }); SupplierWindow = new RelayCommand <Window>((p) => { return(true); }, (p) => { if (_UserIDRole != 1) { LoadDialogErrorNotPermission(); return; } SupplierWindow wd = new SupplierWindow(); wd.ShowDialog(); }); StatisticalWindow = new RelayCommand <Window>((p) => { return(true); }, (p) => { if (_UserIDRole != 1) { LoadDialogErrorNotPermission(); return; } StatisticalWindow wd = new StatisticalWindow(); wd.ShowDialog(); }); UnitWindow = new RelayCommand <Window>((p) => { return(true); }, (p) => { if (_UserIDRole != 1) { LoadDialogErrorNotPermission(); return; } UnitWindow wd = new UnitWindow(); wd.ShowDialog(); }); UserListWindow = new RelayCommand <Window>((p) => { return(true); }, (p) => { if (_UserIDRole != 1) { LoadDialogErrorNotPermission(); return; } UserListWindow wd = new UserListWindow(); wd.ShowDialog(); }); AccountCreateWindow = new RelayCommand <Window>((p) => { return(true); }, (p) => { if (_UserIDRole != 1) { LoadDialogErrorNotPermission(); return; } AccountCreateWindow wd = new AccountCreateWindow(); wd.ShowDialog(); }); BillWindow = new RelayCommand <Window>((p) => { return(true); }, (p) => { if (_UserIDRole != 1) { LoadDialogErrorNotPermission(); return; } BillWindow wd = new BillWindow(); wd.ShowDialog(); }); LoadMainWindow = new RelayCommand <Window>((p) => { return(true); }, (p) => { if (!isLoaded) { isLoaded = true; if (p == null) { return; } p.Hide(); LoginWindow wd = new LoginWindow(); wd.ShowDialog(); var loginViewModel = wd.DataContext as LoginViewModel; if (loginViewModel == null) { return; } if (loginViewModel.isLogin) { loadUserCurrentLogin(); p.Show(); } else { p.Close(); } } }); LoadEditCommand = new RelayCommand <object>((p) => { return(true); }, (p) => { LoadDialogAccountEdit(); }); }