private void _cmbFileFormats_SelectedIndexChanged(object sender, EventArgs e) { try { PrinterFileFormat fileFormat = _printerSettings._lstFormats[_cmbFileFormats.SelectedIndex]; _txtSavePath.Text = fileFormat._strSaveLocation; } catch { } }
public PrinterSettings() { _strDescreption = "Insert actual printer description here. This description will be sent to the user client demo as initialization data."; _lstFormats = new List <PrinterFileFormat>(); String PersonalFolder = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); PrinterFileFormat fileFormat = new PrinterFileFormat("PDF", PersonalFolder); _lstFormats.Add(fileFormat); fileFormat = new PrinterFileFormat("XPS", PersonalFolder); _lstFormats.Add(fileFormat); fileFormat = new PrinterFileFormat("DOC", PersonalFolder); _lstFormats.Add(fileFormat); fileFormat = new PrinterFileFormat("DOCX", PersonalFolder); _lstFormats.Add(fileFormat); }
public void SetBytes(byte[] bytes) { Encoding unicode = Encoding.Unicode; if (_lstFormats != null) { _lstFormats.Clear(); } string strBytes = new string(unicode.GetChars(bytes)); int nIndex; nIndex = strBytes.IndexOf("---"); _strDescreption = strBytes.Substring(0, nIndex); strBytes = strBytes.Substring(nIndex + 3); string strFormat = "", strLocation = ""; while (true) { try { nIndex = strBytes.IndexOf("---"); strFormat = strBytes.Substring(0, nIndex); strBytes = strBytes.Substring(nIndex + 3); nIndex = strBytes.IndexOf("---"); strLocation = strBytes.Substring(0, nIndex); strBytes = strBytes.Substring(nIndex + 3); PrinterFileFormat fileFormat = new PrinterFileFormat(strFormat, strLocation); _lstFormats.Add(fileFormat); } catch (System.Exception) { break; } } }
public void AddFileFormat(PrinterFileFormat fileFormat) { _lstFormats.Add(fileFormat); }