コード例 #1
0
        //--------------------------------------------------------------------//
        //                                                        M e t h o d //
        // i n i t i a l i s e                                                //
        //--------------------------------------------------------------------//
        //                                                                    //
        // Initialise 'target' data.                                          //
        //                                                                    //
        //--------------------------------------------------------------------//

        private void initialise()
        {
            TargetCore.metricsLoadNetPrinter(ref _printerAddress,
                                             ref _printerPort,
                                             ref _timeoutSend,
                                             ref _timeoutReceive);

            txtPrinterAddress.Text = _printerAddress;
            txtPrinterPort.Text    = _printerPort.ToString();

            txtTimeoutSend.Text    = _timeoutSend.ToString();
            txtTimeoutReceive.Text = _timeoutReceive.ToString();

            //----------------------------------------------------------------//
            //                                                                //
            // Set the (hidden) slider object to the passed-in scale value.   //
            // The slider is used as the source binding for a scale           //
            // transform in the (child) Options dialogue window, so that all  //
            // windows use the same scaling mechanism as the main window.     //
            //                                                                //
            // NOTE: it would be better to bind the transform directly to the //
            //       scale value (set and stored in the Main window), but (so //
            //       far) I've failed to find a way to bind directly to a     //
            //       class object Property value.                             //
            //                                                                //
            //----------------------------------------------------------------//

            Double windowScale = MainFormData.WindowScale;

            zoomSlider.Value = windowScale;

            //----------------------------------------------------------------//
            //                                                                //
            // Setting sizes to the resizeable DockPanel element doesn't work!//
            //                                                                //
            //----------------------------------------------------------------//

            this.Height = 280 * windowScale;
            this.Width  = 440 * windowScale;

            // Double h = resizeable.Height;
            // Double w = resizeable.Width;

            // this.Height = h;
            // this.Width = w;
        }
コード例 #2
0
        //--------------------------------------------------------------------//
        //                                                        M e t h o d //
        // r e s e t T a r g e t                                              //
        //--------------------------------------------------------------------//
        //                                                                    //
        // Reset the text on the 'Generate' button.                           //
        //                                                                    //
        //--------------------------------------------------------------------//

        public void resetTarget()
        {
            TargetCore.eTarget targetType = TargetCore.getType();

            if (targetType == TargetCore.eTarget.File)
            {
                btnGenerate.Content = "Copy PRN file contents to file";
            }
            else if (targetType == TargetCore.eTarget.NetPrinter)
            {
                String netPrnAddress = "";
                Int32  netPrnPort    = 0;

                Int32 netTimeoutSend    = 0;
                Int32 netTimeoutReceive = 0;

                TargetCore.metricsLoadNetPrinter(ref netPrnAddress,
                                                 ref netPrnPort,
                                                 ref netTimeoutSend,
                                                 ref netTimeoutReceive);

                btnGenerate.Content = "Send PRN file contents to " +
                                      "\r\n" +
                                      netPrnAddress + " : " +
                                      netPrnPort.ToString();
            }
            else if (targetType == TargetCore.eTarget.WinPrinter)
            {
                String winPrintername = "";

                TargetCore.metricsLoadWinPrinter(ref winPrintername);

                btnGenerate.Content = "Send PRN file contents to printer " +
                                      "\r\n" +
                                      winPrintername;
            }
        }