Пример #1
0
        public void StartPrint(SlicedFiles sf, GCodeFile m_gcode, AxisControl zaxis, MainPage m_page)
        {
            if (Printing)
            {
                return;
            }

            slicefiles = sf;
            gcode      = m_gcode;
            m_main     = m_page;
            m_zaxis    = zaxis;

            Printing = true;

            printing_state  = STATE_START;
            PrintingProcess = true;

            // m_main.Printstarted(0);
            Process();

            //m_page.SetImage(0);
        }
Пример #2
0
        //private void InitGPIO()
        //{
        //    var gpio = GpioController.GetDefault();

        //    // Show an error if there is no GPIO controller
        //    if (gpio == null)
        //    {
        //        pin = null;
        //        GpioStatus.Text = "There is no GPIO controller on this device.";
        //        return;
        //    }

        //    pin = gpio.OpenPin(LED_PIN);
        //    pin.Write(GpioPinValue.High);
        //    pin.SetDriveMode(GpioPinDriveMode.Output);

        //    GpioStatus.Text = "GPIO pin initialized correctly.";
        //}

        private async void InitAppSvc()
        {
            // Initialize the AppServiceConnection
            appServiceConnection = new AppServiceConnection();
            //WebServer_hz258y3tkez3a
            //WebServer_1w720vyc4ccym
            //WebServer_1w720vyc4ccym
            //appServiceConnection.PackageFamilyName = "WebServer_hz258y3tkez3a";
            appServiceConnection.PackageFamilyName = "WebServer_1w720vyc4ccym";
            appServiceConnection.AppServiceName    = "App2AppComService";

            m_sf    = new SlicedFiles();
            m_gcode = new GCodeFile();
            bm      = new BuildManager();
            zaxis   = new AxisControl();

            //initialize USB serial connection VID_0403 PID_6001 - LCD printer
            //zaxis.InitializeConnection("VID_2341", "PID_0010");
            zaxis.InitializeConnection("VID_0403", "PID_6001");


            tokenSource = new CancellationTokenSource();

            // Send a initialize request
            var res = await appServiceConnection.OpenAsync();

            if (res == AppServiceConnectionStatus.Success)
            {
                var message = new ValueSet();
                message.Add("Command", "Initialize");
                var response = await appServiceConnection.SendMessageAsync(message);

                if (response.Status != AppServiceResponseStatus.Success)
                {
                    throw new Exception("Failed to send message");
                }
                appServiceConnection.RequestReceived += OnMessageReceived;
            }
        }