object doneRender()
                {
                    try
                    {
                        //ToolMsg.progressStart(null, "T_REPORT");
                        //var task = new System.Threading.Tasks.Task(() =>
                        //{

                        var cmdLine = ToolObjectName.create(_name, _args);

                        try
                        {
                            //
                            //var repSource = new ImplReportServerSource(_environment, _cmd);
                            //var dsgns = repSource.getReports();
                            //
                            var dsgn   = new ImplReportServer(_environment, cmdLine);
                            var render = _environment.gerReportRender();
                            render.setReport(dsgn);
                            render.done();
                        }
                        catch (Exception exc)
                        {
                            _environment.getExceptionHandler().setException(exc);
                        }
                        finally
                        {
                            ToolMsg.progressStop();
                        }


                        //});

                        //task.Start();
                    }
                    catch (Exception exc)
                    {
                        _environment.getExceptionHandler().setException(exc);
                    }

                    return(null);
                }
            public static void initNs(EventHandler pHandler)
            {
                string val_ = ENV.getEnvString(NSLIST, string.Empty);

                if (string.IsNullOrEmpty(val_))
                {
                    return;
                }

                var arr_ = ToolString.explodeList(val_);

                ToolMsg.askList(null, arr_, (s, e) =>
                {
                    if (pHandler != null)
                    {
                        var ns_  = arr_[e.Which];
                        nsPerfix = ns_;
                        pHandler.Invoke(s, EventArgs.Empty);
                    }
                });
            }
Beispiel #3
0
                internal bool openBT()
                {
                    BluetoothAdapter mBluetoothAdapter = getAdapter();
                    BluetoothDevice  mmDevice          = null;


                    if (mBluetoothAdapter == null)
                    {
                        ToolMobile.log("no bt adapter");

                        ToolMsg.show(null, MessageCollection.T_MSG_ERROR_CONNECTION + " [BLUETOOTH]", null);
                        return(false);
                    }



                    if (!mBluetoothAdapter.IsEnabled)
                    {
                        ToolMobile.log("enable bt adapter");

                        mBluetoothAdapter.Enable();

                        for (int i = 0; i < 15; ++i)
                        {
                            if (mBluetoothAdapter.IsEnabled)
                            {
                                break;
                            }
                            Thread.Sleep(100);
                        }


                        if (!mBluetoothAdapter.IsEnabled)
                        {
                            ToolMsg.show(null, MessageCollection.T_MSG_ERROR_CONNECTION + " [BLUETOOTH]", null);
                            return(false);
                        }
                    }

                    List <string> list = new List <string>();

                    foreach (BluetoothDevice dev_ in mBluetoothAdapter.BondedDevices)
                    {
                        list.Add(dev_.Name);

                        if (dev_.Name == CurrentVersion.ENV.getPrinter())
                        {
                            mmDevice = dev_;
                            break;
                        }
                    }



                    if (mmDevice == null)
                    {
                        string[] arr_ = list.ToArray();
                        ToolMsg.askList(null, arr_, (o, e) =>
                        {
                            if (e.Which >= 0 && e.Which < arr_.Length)
                            {
                                CurrentVersion.ENV.setPrinter(arr_[e.Which]);
                            }
                        });

                        // ToolMsg.show(null, MessageCollection.T_MSG_ERROR_NO_DATA + " BLUETOOTH = [" + CurrentVersion.ENV.getPrinter() + "]", null);
                        return(false);
                    }

                    try
                    {
                        //mBluetoothAdapter.StartDiscovery();
                        //for (int i = 0; i < 10; ++i)
                        //{
                        //    if (mBluetoothAdapter.IsDiscovering)
                        //        break;
                        //    Thread.Sleep(100);

                        //}

                        // UUID uuid = UUID.FromString("00001101-0000-1000-8000-00805f9b34fb");


                        IntPtr createRfcommSocket = JNIEnv.GetMethodID(mmDevice.Class.Handle, "createRfcommSocket", "(I)Landroid/bluetooth/BluetoothSocket;");

                        IntPtr _socket = JNIEnv.CallObjectMethod(mmDevice.Handle, createRfcommSocket, new Android.Runtime.JValue(1));

                        mmSocket = Java.Lang.Object.GetObject <BluetoothSocket>(_socket, JniHandleOwnership.TransferLocalRef);

                        mBluetoothAdapter.CancelDiscovery();

                        mmSocket.Connect();

                        //           Method m = mmDevice.GetType().GetMethod("CreateRfcommSocket", new Type[] {int.class});
                        //tmp = (BluetoothSocket) m.invoke(device, 1);

                        // mmSocket = mmDevice.CreateRfcommSocketToServiceRecord(uuid);


                        // mmSocket.Connect();

                        //time out not supported
                        // mmInputStream.ReadTimeout = mmInputStream.WriteTimeout = mmOutputStream.ReadTimeout = mmOutputStream.WriteTimeout = 5000;
                        return(true);
                    }
                    catch (Exception exc)
                    {
                        ToolMobile.log(exc.ToString());
                        ToolMobile.setExceptionInner(exc);
                    }
                    finally
                    {
                    }

                    return(false);
                }