private void btnLoadBui_Click(object sender, RoutedEventArgs e) { BuiFile buiFile = new BuiFile(); OpenFileDialog ofd = new OpenFileDialog(); ofd.FileName = ""; ofd.DefaultExt = "*.b*"; ofd.Filter = "TRNBuld File (*.bui;*.b17;*.b18)|*.bui;*.b17;*.b18"; if (ofd.ShowDialog() == true) { buiFile.Load(ofd.FileName); convertBuiToDot(buiFile); } }
public MainWindow() { InitializeComponent(); bool exitOption = false; FileInfo buiFileInfo = null; if (App.CommandLineArgs != null) { if (GetBuiFileAndOption(ref buiFileInfo, ref exitOption)) { BuiFile buiFile = new BuiFile(); buiFile.Load(buiFileInfo.FullName); convertBuiToDot(buiFile); if (exitOption) { Application.Current.Shutdown(); //終了 } } } }
/// <summary> /// Drag&Drop /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Window_Drop(object sender, DragEventArgs e) { DroppedFiles list = this.DataContext as DroppedFiles; string[] files = e.Data.GetData(DataFormats.FileDrop) as string[]; if (files != null) { if (checkFileNmae(files[0])) { BuiFile buiFile = new BuiFile(); buiFile.Load(files[0]); convertBuiToDot(buiFile); } else { this.Activate(); // bring the window to the foreground. var msg = "Non-bui file was dropped. Please drop the Bui file here."; MessageBox.Show(this, msg, "Non-bui file", MessageBoxButton.OK); this.txtBox.Text = "Error !!\n" + msg; } } }