public static void SaveJobConfiguration(Job_Configuration configuration) { RCS_Job jobMessage = new RCS_Job(configuration, RemoteType.Client); byte[] bytes = Remote_Content_Show_MessageGenerator.GetMessageAsByte(jobMessage); try { File.WriteAllBytes(Path.Combine(GetWriteablePath(), SavedJobConfigurationFilename), bytes); } catch (Exception) { EventsManager.Log(Job_EventType.Error, configuration, "The job configuration could not be saved."); } }
private void LoadDenJob_Click(object sender, RoutedEventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); ofd.Multiselect = false; ofd.Filter = "Remote Control Show Job (*.rcs)|*.rcs|All files (*.*)|*.*"; if (ofd.ShowDialog() == true) { if (!string.IsNullOrWhiteSpace(ofd.FileName)) { try { FileStream fs = new FileStream(ofd.FileName, FileMode.Open); fs.Seek(0, SeekOrigin.Begin); byte[] data = new byte[fs.Length]; fs.Read(data, 0, data.Length); fs.Close(); this.currentJob = Remote_Content_Show_MessageGenerator.GetMessageFromByte<RCS_Job>(data); this.JobName.Text = this.currentJob.Configuration.Name; } catch { MessageBox.Show("Fehler beim Laden!", "Info", MessageBoxButton.OK, MessageBoxImage.Information); } } } }