protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); MainWindow mainWindow = new(); if (e.Args.Length > 0) { TextArchive textArchive = new TextArchive ( fileName: Path.GetFileName(e.Args[0]), fileSource: e.Args[0], hasSaved: true, text: File.ReadAllText(e.Args[0]), lastModified: File.GetLastWriteTimeUtc(e.Args[0]) ); mainWindow = new MainWindow(textArchive); } else if (!string.IsNullOrEmpty(ConfigurationManager.AppSettings["lastTextFile"])) { string resumeFilePath = ConfigurationManager.AppSettings["lastTextFile"]; TextArchive textArchive = new TextArchive ( fileName: Path.GetFileName(resumeFilePath), fileSource: resumeFilePath, hasSaved: true, text: File.ReadAllText(resumeFilePath), lastModified: File.GetLastWriteTimeUtc(resumeFilePath) ); mainWindow = new MainWindow(textArchive); } mainWindow.Closed += MainWindow_Closed; mainWindow.Show(); }
private void BtnAbrirArquivo_Click(object sender, RoutedEventArgs e) { QueryInvoker <TextArchive> queryInvoker = new(new OpenCommand()); textArchive = queryInvoker.Invoker(); LoadInfoText(); }
public MainWindow(TextArchive textArchive = null) { InitializeComponent(); this.textArchive = textArchive; LoadWindowData(); LoadConfiguration(); if (textArchive != null) { LoadInfoText(); } }
public void Execute() { TextArchive textArchiveNewWindow = TextArchive.OpenFileArchive(); if (textArchiveNewWindow == null) { return; } MainWindow mainWindow = new MainWindow(textArchiveNewWindow); mainWindow.Show(); }
private async void BtnSaveWith_Click(object sender, RoutedEventArgs e) { pgbAsyncTasks.Visibility = Visibility.Visible; QueryInvoker <Task <TextArchive> > queryInvoker = new(new SaveWithCommand(textArchive)); textArchive = await queryInvoker.Invoker(); if (textArchive != null) { LoadInfoText(); } pgbAsyncTasks.Visibility = Visibility.Hidden; }
public FileInfo(TextArchive textArchive) { InitializeComponent(); BitmapImage image = new BitmapImage(); image.BeginInit(); image.UriSource = new Uri(AppDomain.CurrentDomain.BaseDirectory + @"\assets\imgs\txt_file.png"); image.EndInit(); imgFileText.Source = image; txtFileName.Text = textArchive.fileName; txtFileSize.Text = new System.IO.FileInfo(textArchive.fileSource).Length.ToString() + "KB"; txtFileSource.Text = textArchive.fileSource; txtLastUpdate.Text = File.GetLastWriteTimeUtc(textArchive.fileSource).ToString(); txtLastAccess.Text = File.GetLastAccessTimeUtc(textArchive.fileSource).ToString(); txtCreateDate.Text = File.GetCreationTimeUtc(textArchive.fileSource).ToString(); btnFecharInfo.Click += BtnFecharInfo_Click; }
public SaveCommand(TextArchive textArchive) { this.textArchive = textArchive; }
public ShowFileInfoCommand(TextArchive textFileToOpen) { this.textFileToOpen = textFileToOpen; }