Пример #1
0
        private void PCCDSolve_Activate(object sender, System.EventArgs e)
        {
            currProduct = PCCDMainEntrance.result;
            string xx       = Directory.GetCurrentDirectory();
            var    currPath = Path.Combine(Environment.CurrentDirectory, "\\PrinterInfo.xml");

            pnts = XmlHelper.FromXmlFile <Printers>(currPath);
            if (pnts.printer.Count != 0)
            {
                for (int i = 0; i < pnts.printer.Count; i++)
                {
                    comboBox1.Items.Add(pnts.printer[i].Name);
                }
            }
            else
            {
                MessageBox.Show("None printer information exists! Please add printers.");
            }
            comboBox4.Items.Clear();
            // comboBox4 & 5
            for (int i = 0; i < currProduct.parts.Count; i++)
            {
                comboBox4.Items.Add(i + 1);
            }
            // IEnumerable<RhinoObject> rhObjs = doc.Objects.GetObjectList(settings);
            // rhObjList = rhObjs.ToList();
            //Original_Layer.LayerIndex = doc.Layers.FindByFullPath("Default", true);
            Original_Layer = doc.Layers.CurrentLayer;
            txtBox_outputPath.Focus();
        }
Пример #2
0
        public void Cancel()
        {
            try
            {
                Start();
                var printers = new Printers();

                if (IsActionSupported(printers.Default.PrinterName, PrinterActionCode.CancelAllJobs))
                {
                    _log.Debug($"PrinterActionCode.CancelAllJobs is supported");
                    printers.Default.ExecuteAction(PrinterActionCode.CancelAllJobs);
                }
                else
                {
                    _log.Debug($"PrinterActionCode.CancelAllJobs is not supported");
                }
                if (IsActionSupported(printers.Default.PrinterName, PrinterActionCode.CancelQueuedJobs))
                {
                    _log.Debug($"PrinterActionCode.CancelQueuedJobs is not supported");
                    printers.Default.ExecuteAction(PrinterActionCode.CancelQueuedJobs);
                }
            }
            catch (Exception e)
            {
                _log.Error(e.Message, e);
            }
        }
Пример #3
0
 /// <summary>
 /// Добавляет новый принтер в общий список.
 /// </summary>
 /// <param name="newPrinter">Новый принтер</param>
 public void AddNewPrinter(PrinterDTO newPrinter)
 {
     if (newPrinter != null)
     {
         Printers.Add(newPrinter);
     }
 }
Пример #4
0
        public void GetPacsNodeParametersByAETest()
        {
            //PrivateType type = new PrivateType(typeof(Printers));                             //Class1为要测试的类。
            //PrivateObject privateObj = new PrivateObject(Printers.Instance, type);

            //Printers_Accessor target = new Printers_Accessor(privateObj);
            Printers target = Printers.Instance;

            string sNodeAE          = "LEAD_SERVER"; //
            var    peerNode         = new PeerNode();
            var    peerNodeExpected = new PeerNode {
                PeerAE = "LEAD_SERVER", PeerIP = "10.1.3.194", PeerPort = 10006
            };
            int expected = 0;
            int actual;

            //actual = target.GetPacsNodeParametersByAE(sNodeAE, ref peerNode);
            //Assert.AreEqual(peerNodeExpected.PeerAE,peerNode.PeerAE);
            //Assert.AreEqual(peerNodeExpected.PeerIP,peerNode.PeerIP);
            //Assert.AreEqual(peerNodeExpected.PeerPort,peerNode.PeerPort);
            //Assert.AreEqual(expected, actual);

            sNodeAE  = "aa";
            peerNode = new PeerNode();
            actual   = target.GetPacsNodeParametersByAE(sNodeAE, ref peerNode);
            expected = -1;
            Assert.AreEqual(expected, actual);
        }
Пример #5
0
 public PosSettings()
 {
     foreach (string printer in System.Drawing.Printing.PrinterSettings.InstalledPrinters)
     {
         Printers.Add(printer);
     }
 }
Пример #6
0
        /// <summary>
        /// Updates available printers
        /// </summary>
        /// <returns>available printers</returns>
        public Printers UpdateAvailablePrinters()
        {
            LogHelper.LogDebug();

            try
            {
                _availablePrinters = null;
                // just retrieve new data
                var xxx = AvailablePrinters;

                LogHelper.LogDebug("HasAvailablePrinters : " + HasAvailablePrinters);

                // change (real) printers of local print event watcher
                if (localPrintEventWatcher != null)
                {
                    localPrintEventWatcher.PrintersToPauseAndShow = new List <string>();

                    // check if there are available printers
                    if (HasAvailablePrinters)
                    {
                        LogHelper.LogDebug("AvailablePrinters : " + AvailablePrinters.NamesInSystem.Count);

                        // add (real) printers
                        localPrintEventWatcher.PrintersToPauseAndShow.AddRange(AvailablePrinters.NamesInSystem);
                    }
                }

                return(_availablePrinters);
            }
            catch (Exception ex)
            {
                WPFNotifier.DebugError(ex);
                return(null);
            }
        }
Пример #7
0
        public ActionResult Print(Guid?id, bool Print = false)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Item item = db.Items.Find(id);

            if (item == null)
            {
                return(HttpNotFound());
            }

            if (Print)
            {
                //<input type="file" accept="image/*" capture="camera"> <--- Awesome!
                Printers x       = new Printers();
                var      printer = x.First();
                ILabel   label   = Label.Open("barcode.label");
                label.SetObjectText("BARCODE", item.NonExclusiveRef);
                label.Print(printer);
                return(RedirectToAction("Index")); // printed
            }
            else
            {
                return(View(item));
            }
        }
Пример #8
0
        public static void Calculate()
        {
            Stopwatch stopWatch = new Stopwatch();

            stopWatch.Start();

            Calculation calc = CalculationGenerator.GenerateStandardIslem();

            //calc = new Calculation
            //{
            //    Input = new int[] { 2, 8, 7, 5, 25, 10 },
            //    Target = 777
            //};

            //Printers.PrintSolution(solution);
            //Printers.PrintInput(calc);
            CalculationProcessor.Solve(calc);
            Printers.PrintSolutions(calc);
            //Solution solution = SolutionProcessor.CraziestSolution(calc);
            //Printers.PrintSolution(solution);
            //Console.WriteLine($"Target {calc.Target} have no solution!\n");
            stopWatch.Stop();
            Console.WriteLine(stopWatch.Elapsed);
            _ = calc;
        }
Пример #9
0
        private void Print(bool isColorDocument)
        {
            var availablePrinters = new Printers
            {
                new Printer {
                    Name = "ColorPrinter", IsColored = true
                },
                new Printer {
                    Name = "Black-WhitePrinter", IsColored = false
                },
                new Printer {
                    Name = "BackPrinter", IsColored = false
                },
                new Printer {
                    Name = "cubicle01_printer", IsColored = false
                },
                new Printer {
                    Name = "cubicle02_printer", IsColored = false
                },
                new Printer {
                    Name = "cubicle05_printer", IsColored = false
                }
            };

            this.KillActiveWindow();

            activeWindow = new PrintingControlWindow(ComputerText.Text, "MySpreadsheet.xls", 22, 4, 2, isColorDocument, availablePrinters);
            activeWindow.Show();
        }
Пример #10
0
        public Repl(
            string[] scriptArgs,
            IFileSystem fileSystem,
            IScriptEngine scriptEngine,
            IObjectSerializer serializer,
            ILogProvider logProvider,
            IScriptLibraryComposer composer,
            IConsole console,
            IFilePreProcessor filePreProcessor,
            IEnumerable <IReplCommand> replCommands,
            Printers printers,
            IScriptInfo scriptInfo)
            : base(fileSystem, filePreProcessor, scriptEngine, logProvider, composer, scriptInfo)
        {
            Guard.AgainstNullArgument("serializer", serializer);
            Guard.AgainstNullArgument("logProvider", logProvider);
            Guard.AgainstNullArgument("console", console);

            _scriptArgs = scriptArgs;
            _serializer = serializer;
            _printers   = printers;
            _log        = logProvider.ForCurrentType();
            Console     = console;
            Commands    = replCommands != null?replCommands.Where(x => x.CommandName != null).ToDictionary(x => x.CommandName, x => x) : new Dictionary <string, IReplCommand>();
        }
Пример #11
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public static Printers GetPrinters()
        {
            try
            {
                LogHelper.LogDebug();
                Printers printers = new Printers();
                ManagementObjectSearcher   searchPrinters    = new ManagementObjectSearcher(_searchQueryPrinters);
                ManagementObjectCollection printerCollection = searchPrinters.Get();
                foreach (ManagementObject printer in printerCollection)
                {
                    PrinterSettings ps = new PrinterSettings();
                    ps.PrinterName = printer.Properties["Name"].Value.ToString();

                    if (ps.IsValid)
                    {
                        printers.Add(new Printer(ps.PrinterName, ps.PrinterName, ps.IsDefaultPrinter, ps.SupportsColor));
                    }
                }

                return(printers);
            }
            catch (Exception ex)
            {
                LogHelper.Log(ex);
                return(null);
            }
        }
Пример #12
0
        private void SetUpPrinters()
        {
            Printers printers;

            try
            {
                printers = new Printers();
            }
            catch (Exception)
            {
                return;
            }

            foreach (var printer in printers)
            {
                orderPrinterComboBox.Items.Add(printer.PrinterName);
                programPrinterComboBox.Items.Add(printer.PrinterName);
                serviceTagPrinterComboBox.Items.Add(printer.PrinterName);
            }

            if (printers.Count > 0)
            {
                orderPrinterComboBox.SelectedItem = printers.Any(printer => printer.PrinterName == settings.OrderPrinterName)
                    ? settings.OrderPrinterName
                    : printers.Default.PrinterName;

                programPrinterComboBox.SelectedItem = printers.Any(printer => printer.PrinterName == settings.ProgramPrinterName)
                    ? settings.ProgramPrinterName
                    : printers.Default.PrinterName;

                serviceTagPrinterComboBox.SelectedItem = printers.Any(printer => printer.PrinterName == settings.ServiceTagPrinterName)
                    ? settings.ServiceTagPrinterName
                    : printers.Default.PrinterName;
            }
        }
Пример #13
0
        static void Main(string[] args)
        {
            Console.WriteLine("Przedmiot: Metody Inżynierii Wiedzy");
            Console.WriteLine("Autor: Kamil Makarowski");
            Printers.ShowMenu();
            int    choice;
            string inputLine = "";

            while (inputLine != "q")
            {
                inputLine = Console.ReadLine();
                Int32.TryParse(inputLine, out choice);
                switch (choice)
                {
                case 1:
                    Console.Clear();
                    SimpleKNN.SimpleKNN.DoKNN();
                    break;

                case 2:
                    Console.Clear();
                    DataMinning.DataMining.DoDataMining();
                    break;

                default:
                    break;
                }
                Console.Clear();
                Printers.ShowMenu();
            }
            Console.WriteLine("Dziękuje za skorzystanie z aplikacji");
            Console.ReadKey();
        }
        /// Init
        #region Init

        /// <summary>
        /// Constructor. Virtual Printer Mode.
        /// </summary>
        /// <param name="psFileName">postscript file name</param>
        public PrintingControlModel(string psFileName, PrintJobTitle title)
        {
            IsBlockedMode = false;
            PSFileName    = psFileName;
            Title         = title;
            if (Title == null)
            {
                Title = new PrintJobTitle(null, "unknown", null, null, -1);
            }

            if (Title.PrinterName.Equals(ConfigData.PrinterName2))
            {
                IsColorVirtualPrinterSelected = true;
            }

            ChosenPrinter        = new Printer();
            IsControlsEnabled    = false;
            SelectedPrinterIndex = 0;
            Printers             = new Printers();

            // initialize timer
            timerAllowedToPrint          = new System.Windows.Forms.Timer();
            timerAllowedToPrint.Enabled  = false;
            timerAllowedToPrint.Interval = ConfigData.Interval_TimerAllowedToPrint;
            timerAllowedToPrint.Tick    += timerAllowedToPrint_Tick;
        }
Пример #15
0
        static bool getSnmp(string host, string OID)
        {
            bool result = false;

            SimpleSnmp snmpVerb = new SimpleSnmp(host, 161, "public", 500, 0);

            if (!snmpVerb.Valid)
            {
                return(result);
            }

            Oid varbind = new Oid(OID);

            Dictionary <Oid, AsnType> snmpDataS = snmpVerb.Get(SnmpVersion.Ver1, new string[] { varbind.ToString() });

            if (snmpDataS != null)
            {
                string temp = snmpDataS[varbind].ToString();
                // Get MANUFACTURER
                int    startIndex = temp.IndexOf("MFG:");
                int    endIndex   = temp.IndexOf(";", startIndex);
                string mfg        = temp.Substring(startIndex + 4, endIndex - (startIndex + 4));
                // Get MODEL
                startIndex = temp.IndexOf("MDL:");
                endIndex   = temp.IndexOf(";", startIndex);
                string   printerMDL = temp.Substring(startIndex + 4, endIndex - (startIndex + 4));
                Printers data       = new Printers();
                Printers.PrinterList.Add(host + " " + mfg + " " + printerMDL);
            }
            return(result);
        }
Пример #16
0
        private async void OnInstallService(bool value)
        {
            try
            {
                ShowBusyControl();
                await _windowsServiceClient.DisconnectAsync();

                await _settingsService.InstallService(value);

                await _windowsServiceClient.ConnectAsync(ShowConnectionFailedMessage);
            }
            catch (Exception e)
            {
                _loggingService?.WriteError(e);
            }
            finally
            {
                HideBusyControl();
            }

            try
            {
                if (InstallService && Printers?.Any() != true)
                {
                    InitializePrinters();
                }

                RaisePropertyChanged(nameof(InstallService));
            }
            catch (Exception e)
            {
                _loggingService?.WriteError(e);
            }
        }
Пример #17
0
        private void FillCombo(ComboBox combo)
        {
            PrintSituation sit           = GetSit(combo);
            Printer        printerForSit = Printers.GetForSit(sit);
            string         printerName   = "";

            if (printerForSit != null)
            {
                printerName = printerForSit.PrinterName;
            }
            combo.Items.Clear();
            if (combo == comboDefault)
            {
                combo.Items.Add(Lan.g("FormSetupWizard", "Windows default"));
            }
            else
            {
                combo.Items.Add(Lan.g("FormSetupWizard", "default"));
            }
            for (int i = 0; i < PrinterSettings.InstalledPrinters.Count; i++)
            {
                combo.Items.Add(PrinterSettings.InstalledPrinters[i]);
                if (printerName == PrinterSettings.InstalledPrinters[i])
                {
                    combo.SelectedIndex = i + 1;
                }
            }
            if (combo.SelectedIndex == -1)
            {
                combo.SelectedIndex = 0;
            }
        }
Пример #18
0
        private List <Printers> ValidatePrinters(List <Printers> objList)
        {
            Thread thread = new Thread(() =>
            {
                Printers objPrintre = new Printers();
                string printerName;
                ManagementObjectSearcher theSearcher = new ManagementObjectSearcher("SELECT * FROM Win32_Printer");
                foreach (ManagementObject mo in theSearcher.Get())
                {
                    printerName = mo["Name"].ToString().ToLower();

                    if (!mo["WorkOffline"].ToString().ToLower().Equals("true"))
                    {
                        objPrintre      = new Printers();
                        objPrintre.Id   = count++;
                        objPrintre.Name = printerName;
                        objList.Add(objPrintre);
                    }
                }
            });

            thread.Start();
            thread.Join();
            return(objList);
        }
        /// <summary>
        /// Constructor. Real Printer Mode.
        /// </summary>
        /// <param name="data">print job data</param>
        public PrintingControlModel(PrintJobData data)
        {
            IsBlockedMode = true;
            PSFileName    = null;
            PrintJobData  = data;
            Title         = PrintJobData.PrintJobTitle;
            if (Title == null)
            {
                Title = new PrintJobTitle(null, "unknown", null, null, -1);
            }

            NumberOfPages = Title.TotalPages;

            // set the chosen printer accordingly
            ChosenPrinter             = new Printer();
            ChosenPrinter.Name        = Title.PrinterName;
            ChosenPrinter.DisplayName = Title.PrinterName;
            IsControlsEnabled         = true;
            SelectedPrinterIndex      = -1;
            Printers = new Printers();
            //Printers.Add(ChosenPrinter);

            // initialize timer
            timerAllowedToPrint          = new System.Windows.Forms.Timer();
            timerAllowedToPrint.Enabled  = false;
            timerAllowedToPrint.Interval = ConfigData.Interval_TimerAllowedToResumeJob;
            timerAllowedToPrint.Tick    += timerAllowedToPrint_Tick;

            UpdateDataDevMode();
        }
 public ScriptEnvironment(string[] scriptArgs, IConsole console, Printers printers, IScriptInfo scriptInfo = null)
 {
     _console    = console;
     _printers   = printers;
     _scriptInfo = scriptInfo;
     ScriptArgs  = scriptArgs;
 }
Пример #21
0
 /// <summary>
 /// Добавляет новый принтер в список подсети.
 /// </summary>
 /// <param name="newPrinter">Новый принтер</param>
 public void AddPrinter(Printer newPrinter)
 {
     if (newPrinter != null)
     {
         Application.Current.Dispatcher.Invoke(() => Printers.Add(newPrinter));
     }
 }
Пример #22
0
        public FrmBadges()
        {
            InitializeComponent();

            DoRefresh();

            _checkTimer = new System.Threading.Timer(delegate
            {
                try
                {
                    if (_closing)
                    {
                        return;
                    }
                    var printers = new Printers();
                    if (printers.Any())
                    {
                        if (printers.First().IsConnected)
                        {
                            LblStatus.Invoke(new MethodInvoker(delegate
                            {
                                LblStatus.ForeColor = System.Drawing.Color.DarkGreen;
                                LblStatus.Text      = "Connected";
                            }));
                        }
                        else
                        {
                            LblStatus.Invoke(new MethodInvoker(delegate
                            {
                                LblStatus.ForeColor = System.Drawing.Color.Red;
                                LblStatus.Text      = "Disconnected";
                            }));
                        }
                    }
                    else
                    {
                        LblStatus.Invoke(new MethodInvoker(delegate
                        {
                            LblStatus.ForeColor = System.Drawing.Color.Red;
                            LblStatus.Text      = "Disconnected";
                        }));
                    }
                }
                catch
                {
                    try
                    {
                        LblStatus.Invoke(new MethodInvoker(delegate
                        {
                            LblStatus.ForeColor = System.Drawing.Color.Red;
                            LblStatus.Text      = "Error (No Drivers?)";
                        }));
                    }
                    catch
                    {
                    }
                }
            }, null, 0, 1000);
        }
Пример #23
0
 private void button4_Click(object sender, EventArgs e)
 {
     Printers x = new Printers();
     var printer = x.First();
     ILabel label = DYMO.Label.Framework.Label.Open("barcode.label");
     label.SetObjectText("BARCODE", Item.Id);
     label.Print(printer);
 }
Пример #24
0
        public async Task <object> GetPrinters(dynamic input)
        {
            Debug.WriteLine("NodeDymoLibrary: GetPrinters() called");

            IPrinters temp = new Printers();

            return((object)temp.Cast <IPrinter>().ToList());
        }
Пример #25
0
        public static API.Game GenerateGameAPI(string deckString1, string deckString2)
        {
            var game = GenerateGame(deckString1, deckString2);

            Console.WriteLine(Printers.PrintGame(game));

            return(new API.Game(game));
        }
        public BartenderService()
        {
            _pvicontroller = pvicontroller;
            _engine        = new Engine(true);

            var printers = new Printers();

            DefaultPrinterName = printers.Default.PrinterName;
        }
Пример #27
0
        public void TesPrintingInt()
        {
            var number = 8;
            var result = Printers.PrintVariable(number);

            Assert.IsInstanceOfType(result, typeof(BinaryOutput));
            Assert.AreEqual(result.ContentType, "text/plain");
            Assert.AreEqual("8", result.Data);
        }
Пример #28
0
        public void TesPrintingString()
        {
            string text   = "Hello";
            var    result = Printers.PrintVariable(text);

            Assert.IsInstanceOfType(result, typeof(BinaryOutput));
            Assert.AreEqual(result.ContentType, "text/plain");
            Assert.AreEqual("\"Hello\"", result.Data);
        }
Пример #29
0
 /// <summary>
 /// Очищает репозиторий.
 /// </summary>
 public void Clear()
 {
     Subnets.ToList().ForEach(x => x.Printers.Clear());
     Subnets.Clear();
     Printers.Clear();
     ModelSummaries.Clear();
     SubnetSummaries.Clear();
     DeviceCount = 0;
     SubnetCount = 0;
 }
Пример #30
0
        private BartenderService()
        {
            _engine = new Engine();

            var printers = new Printers();

            DefaultPrinterName = printers.Default.PrinterName;

            _log.Info("Starting Bartender Service");
            _log.Info($"Printer name={printers.Default.PrinterName}, Model={printers.Default.PrinterModel} Driver={printers.Default.Driver.Name}, Version={printers.Default.Driver.Version}");
        }
Пример #31
0
        public MainWindowViewModel()
        {
            Settings     = LoadSettings() ?? new GateSettings();
            PrinterNames = new ObservableCollection <string>(Printers.GetPrinterList());
            Printers     = new Printers(Settings);

            FoodCategories = new ObservableCollection <FoodCategory>();
            FoodCategories.Add(new FoodCategory(1, "Pizza and Spagetti "));
            FoodCategories.Add(new FoodCategory(2, "Pasta"));
            FoodCategories.Add(new FoodCategory(3, "Printgate"));
        }
Пример #32
0
        private void SetUpPrinters()
        {
            Printers printers;

            try
            {
                printers = new Printers();
            }
            catch (Exception)
            {
                return;
            }

            foreach (var printer in printers)
            {
                orderPrinterComboBox.Items.Add(printer.PrinterName);
                programPrinterComboBox.Items.Add(printer.PrinterName);
                serviceTagPrinterComboBox.Items.Add(printer.PrinterName);
            }

            if (printers.Count > 0)
            {
                orderPrinterComboBox.SelectedItem = printers.Any(printer => printer.PrinterName == settings.OrderPrinterName)
                    ? settings.OrderPrinterName
                    : printers.Default.PrinterName;

                programPrinterComboBox.SelectedItem = printers.Any(printer => printer.PrinterName == settings.ProgramPrinterName)
                    ? settings.ProgramPrinterName
                    : printers.Default.PrinterName;

                serviceTagPrinterComboBox.SelectedItem = printers.Any(printer => printer.PrinterName == settings.ServiceTagPrinterName)
                    ? settings.ServiceTagPrinterName
                    : printers.Default.PrinterName;
            }
        }
Пример #33
0
        private void button1_Click(object sender, EventArgs e)
        {
            //  "85fdbd26-0a86-4ce4-944c-14b5546e7283"
            var key = Guid.NewGuid().ToString().ToUpper().Substring(0, 8);

            while (DAL.Db.Context.Items.Count(n => n.Id == key) > 0) {
                key = Guid.NewGuid().ToString().Substring(0, 8);
            }

            Printers x = new Printers();
            var printer = x.First();
            ILabel label = DYMO.Label.Framework.Label.Open("barcode.label");
            label.SetObjectText("BARCODE", key);
            label.Print(printer);
        }
Пример #34
0
 public async Task<object> Printers(object input)
 {
     IPrinters printers = new Printers();
     return printers;
 }
Пример #35
0
 private void LoadPrinterList()
 {
     Printers printers = new Printers();
     foreach (Printer printer in printers)
     {
         cboPrinters.Items.Add(printer.PrinterName);
     }
     if (printers.Count > 0)
     {
         // Automatically select the default printer.
         cboPrinters.SelectedItem = printers.Default.PrinterName;
     }
 }