public PrinterSettings() { _strDescreption = "Insert actual printer descriptions here, this description will be sent to the " + "user client demo as initialization data"; _lstFormats = new List <PrinterFileFormat>(); String PersonalFolder = (string) Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders", "Common Documents", ""); if (PersonalFolder == "") { PersonalFolder = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); } PrinterFileFormat fileFormat = new PrinterFileFormat("PDF", PersonalFolder); _lstFormats.Add(fileFormat); fileFormat = new PrinterFileFormat("DOC", PersonalFolder); _lstFormats.Add(fileFormat); fileFormat = new PrinterFileFormat("XPS", PersonalFolder); _lstFormats.Add(fileFormat); fileFormat = new PrinterFileFormat("TEXT", PersonalFolder); _lstFormats.Add(fileFormat); }
private void ApplyPrinterSettings() { _txtPrinterDescription.Text = _printerSettings._strDescreption; foreach (TextBox txtBox in _lstTextBox) { txtBox.Clear(); } for (int i = 0; i < _printerSettings._lstFormats.Count; i++) { PrinterFileFormat fileFormat = _printerSettings._lstFormats[i]; _lstTextBox[i].Text = fileFormat._strSaveLocation; } }
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 { break; } } }
public void AddFileFormat(PrinterFileFormat fileFormat) { _lstFormats.Add(fileFormat); }