Example #1
0
 public UDPReceiver(int port,MainWindow main)
 {
     MainWindowInstance = main;
     this.port = port;
     ConnectionDictionary = new Dictionary<string, string>();
     thread = new Thread(new ThreadStart(listenForConnection));
     thread.Start();
 }
        public DeviceListView(MainWindow main)
        {
            InitializeComponent();

            MainWindowInstance = main;

            this.listBox.ItemsSource = MainWindowInstance.Devices;
            this.MouseDoubleClick += ItemsControl_MouseDoubleClick;
        }
        //Reads the lineparameters from the ticket, and displays the visually depending on type of print-line.
        public TicketEditorView(TicketClass ticket,MainWindow maininstance)
        {
            InitializeComponent();

            Ticket = ticket;

            Ticket.Flipped = 0;
            Ticket.PaperMargin = 0;

            if (Ticket.PaperWidth == 564) {
                stackPanel.Width = 323;
            }

            foreach (TicketClass.LineParameters lineparameters in ticket.Lines)
            {

                switch (lineparameters.Type)
                {

                    case IMAGE_LINE:

                        AddImage(lineparameters);

                        break;

                    case ROWSPACE_LINE:

                        AddLineBreak(lineparameters,-1);

                        break;

                    case TEXT_LINE:

                        AddText(lineparameters);

                        break;

                    case QUEUENUMBER_LINE:

                        AddQueueNumber(lineparameters);

                        break;

                }

            }
            MainWindowInstance = maininstance;

            CodePages = new CodePageList();

            LanguageMenu.ItemsSource = CodePages;

            setMouseEvents();
            DisableButtons();
        }
        public static bool sendHttpPost(String xmlString,MainWindow.SelectedPrinter printer)
        {
            BackgroundWorker backgroundworker = new BackgroundWorker();

            backgroundworker.WorkerReportsProgress = true;
            backgroundworker.WorkerSupportsCancellation = true;

            backgroundworker.DoWork += new DoWorkEventHandler(bw_Request);
            backgroundworker.ProgressChanged += new ProgressChangedEventHandler(bw_ProgressChanged);
            backgroundworker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bw_RunWorkerCompleted);

            backgroundworker.RunWorkerAsync(new string[] {xmlString,printer.Address});

            return false;
        }
        //View with a fresh new ticket
        public TicketEditorView(MainWindow maininstance)
        {
            InitializeComponent();
            setMouseEvents();

            Ticket = new TicketClass();

            MainWindowInstance = maininstance;

            AddDummyText();
            DisableButtons();

            CodePages = new CodePageList();

            LanguageMenu.ItemsSource = CodePages;
        }