Пример #1
0
        public override void OnUpdate()
        {
            base.OnUpdate();
            PrinterObject selectedPrinter = spooler_connection.SelectedPrinter;

            if (selectedPrinter != null && selectedPrinter.IsConnected() && last_selected_printer != selectedPrinter)
            {
                updatingfromprinter = true;
                if (logwaits_checkbox != null)
                {
                    logwaits_checkbox.Checked = selectedPrinter.LogWaits;
                }

                if (logfeedback_checkbox != null)
                {
                    logfeedback_checkbox.Checked = selectedPrinter.LogFeedback;
                }

                updatingfromprinter = false;
            }
            if (selectedPrinter == null || !selectedPrinter.IsConnected() || show_full_log)
            {
                if (spooler_connection.LogUpdated || last_selected_printer != null || log_changed)
                {
                    var childElement = (ListBoxWidget)FindChildElement(1031);
                    if (childElement != null)
                    {
                        List <string> log = spooler_connection.GetLog();
                        childElement.Items.Clear();
                        foreach (var str in log)
                        {
                            childElement.Items.Add(str);
                        }

                        childElement.Refresh();
                        childElement.SetTrackPositionToEnd();
                    }
                }
            }
            else if (selectedPrinter.LogUpdated || last_selected_printer != selectedPrinter || log_changed)
            {
                var childElement = (ListBoxWidget)FindChildElement(1031);
                if (childElement != null)
                {
                    List <string> log = selectedPrinter.GetLog();
                    childElement.Items.Clear();
                    foreach (var str in log)
                    {
                        childElement.Items.Add(str);
                    }

                    childElement.Refresh();
                    childElement.SetTrackPositionToEnd();
                }
            }
            log_changed           = false;
            last_selected_printer = selectedPrinter;
        }