Пример #1
0
        private void LoadPrnInfo()
        {
            LoadComplete = false;
            LoadStarted  = true;

            Console.WriteLine("{0}: --> Printers load begin", DateTime.Now.ToString("HH:mm:ss fff"));

            foreach (string prnName in PrinterSettings.InstalledPrinters)
            {
                Console.WriteLine("{0}: ---> Printers load: {1}", DateTime.Now.ToString("HH:mm:ss fff"), prnName);

                var prn = new Dialogs.PrinterOp(prnName, null);
                Dialogs.PrinterInfo prnInfo = prn.GetInfo();

                List[prnName] = prnInfo;

                if (Updated != null)
                {
                    Updated(this, new InfoArgs(prnInfo));
                }
            }

            LoadComplete = true;
            LoadStarted  = false;

            if (Loaded != null)
            {
                Loaded(this, new EventArgs());
            }

            Console.WriteLine("{0}: --> Printers load end", DateTime.Now.ToString("HH:mm:ss fff"));
        }
Пример #2
0
        public PrintAllDialog(int[] values)
        {
            this.values = values;
            using (
                var dialog = new DocPrintDialog(0, Environment.Settings.Folders.Add("Print"), 0,
                                                Environment.StringResources.GetString("Dialog_PrintAllDialog_Title1"))
            {
                PrintImage = false
            })
            {
                if (dialog.ShowDialog() == DialogResult.OK)
                {
                    printImage  = dialog.PrintImage;
                    mainOnly    = dialog.PrintOnlyMain;
                    eForm       = dialog.PrintEForm;
                    orientation = dialog.Orientation;
                    scaleMode   = dialog.ScaleMode;
                    annotations = dialog.Annotations;
                    copiescount = dialog.CopiesCount;
                    prn         = new PrinterOp(DocPrintDialog.Printer, this);
                    printerInfo = Environment.Printers.List[DocPrintDialog.Printer] as PrinterInfo ?? prn.GetInfo();
                }
            }

            if (printImage || eForm)
            {
                InitializeComponent();
            }
            else
            {
                Load  += PrintAllDialog_Load;
                values = null;
                return;
            }

            InitLayout();
        }
Пример #3
0
        public PrintAllDialog(int[] docIDs, PrintAllFoldersType folderType)
        {
            switch (folderType)
            {
            case PrintAllFoldersType.WorkFolder:
            case PrintAllFoldersType.SearchFolder:
            case PrintAllFoldersType.InquiryFolder:
                values = new int[docIDs.Length];
                docIDs.CopyTo(values, 0);
                break;

            case PrintAllFoldersType.ArchivFolder:
                break;
            }

            using (
                var dialog = new DocPrintDialog(0, Environment.Settings.Folders.Add("Print"), 0,
                                                Environment.StringResources.GetString("Dialog_PrintAllDialog_Title1")))
            {
                if (dialog.ShowDialog() == DialogResult.OK)
                {
                    printImage  = dialog.PrintImage;
                    mainOnly    = dialog.PrintOnlyMain;
                    eForm       = dialog.PrintEForm;
                    orientation = dialog.Orientation;
                    scaleMode   = dialog.ScaleMode;
                    annotations = dialog.Annotations;
                    copiescount = dialog.CopiesCount;
                    prn         = new PrinterOp(DocPrintDialog.Printer, this);
                    printerInfo = Environment.Printers.List[DocPrintDialog.Printer] as PrinterInfo ?? prn.GetInfo();
                }
            }

            if (printImage || eForm)
            {
                InitializeComponent();
            }
            else
            {
                Load  += PrintAllDialog_Load;
                values = null;
                return;
            }

            InitLayoutProperties();
        }
Пример #4
0
        public PrintAllDialog(int folderID, int empID, PrintAllFoldersType folderType)
        {
            switch (folderType)
            {
            case PrintAllFoldersType.WorkFolder:
                using (
                    var dt = Environment.DocData.GetWorkFolderDocs(folderID, empID,
                                                                   Environment.CurCultureInfo.
                                                                   TwoLetterISOLanguageName))
                {
                    if (dt.Rows.Count > 0)
                    {
                        values = new int[dt.Rows.Count];
                        for (int i = 0; i < values.Length; i++)
                        {
                            values[i] = (int)dt.Rows[i][Environment.DocData.IDField];
                        }
                    }
                    else
                    {
                        Load  += PrintAllDialog_Load;
                        values = null;
                        return;
                    }
                    dt.Dispose();
                }
                break;

            case PrintAllFoldersType.ArchivFolder:
                break;

            case PrintAllFoldersType.SearchFolder:
                using (
                    var dt = Environment.DocData.GetFoundDocs(Environment.CurCultureInfo.Name, empID,
                                                              Environment.UserSettings.PersonID))
                {
                    if (dt.Rows.Count > 0)
                    {
                        values = new int[dt.Rows.Count];
                        for (int i = 0; i < values.Length; i++)
                        {
                            values[i] = (int)dt.Rows[i][Environment.DocData.IDField];
                        }
                    }
                    else
                    {
                        Load  += PrintAllDialog_Load;
                        values = null;
                        return;
                    }
                    dt.Dispose();
                }
                break;

            case PrintAllFoldersType.InquiryFolder:
                string xml = Environment.QueryData.GetField(Environment.QueryData.XMLField, folderID).ToString();
                string sql = Data.DALC.Documents.Search.Options.GetSQL(xml);
                using (
                    DataTable dt = Environment.DocData.GetQueryDocs(sql,
                                                                    Environment.CurCultureInfo.
                                                                    TwoLetterISOLanguageName, empID,
                                                                    Environment.UserSettings.PersonID))
                {
                    if (dt.Rows.Count > 0)
                    {
                        values = new int[dt.Rows.Count];
                        for (int i = 0; i < values.Length; i++)
                        {
                            values[i] = (int)dt.Rows[i][Environment.DocData.IDField];
                        }
                    }
                    else
                    {
                        Load  += PrintAllDialog_Load;
                        values = null;
                        return;
                    }
                    dt.Dispose();
                }
                break;
            }

            using (
                var dialog = new DocPrintDialog(0, Environment.Settings.Folders.Add("Print"), values,
                                                Environment.StringResources.GetString("Dialog_PrintAllDialog_Title1")))
            {
                if (dialog.ShowDialog() == DialogResult.OK)
                {
                    printImage  = dialog.PrintImage;
                    mainOnly    = dialog.PrintOnlyMain;
                    eForm       = dialog.PrintEForm;
                    orientation = dialog.Orientation;
                    scaleMode   = dialog.ScaleMode;
                    annotations = dialog.Annotations;
                    copiescount = dialog.CopiesCount;
                    prn         = new PrinterOp(DocPrintDialog.Printer, this);
                    printerInfo = Environment.Printers.List[DocPrintDialog.Printer] as PrinterInfo ?? prn.GetInfo();
                }
            }

            if (printImage || eForm)
            {
                InitializeComponent();
            }
            else
            {
                Load  += PrintAllDialog_Load;
                values = null;
                return;
            }

            InitLayoutProperties();
        }