当前位置: 首页>>代码示例>>C#>>正文


C# PluginResult类代码示例

本文整理汇总了C#中PluginResult的典型用法代码示例。如果您正苦于以下问题:C# PluginResult类的具体用法?C# PluginResult怎么用?C# PluginResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


PluginResult类属于命名空间,在下文中一共展示了PluginResult类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DeviceStatus_PowerSourceChanged

 private void DeviceStatus_PowerSourceChanged(object sender, EventArgs e)
 {
     isPlugged = DeviceStatus.PowerSource.ToString().CompareTo("External") == 0;
     PluginResult result = new PluginResult(PluginResult.Status.OK, GetCurrentBatteryStateFormatted());
     result.KeepCallback = true;
     DispatchCommandResult(result);
 }
开发者ID:9kopb,项目名称:phonegap-app-developer,代码行数:7,代码来源:Battery.cs

示例2: execute_statment

        public void execute_statment(string options)
        {
            string callbackId;
            options = options.Replace("{}", ""); /// empty objects screw up the Deserializer
            try
            {
                /// query params
                string[] args = JSON.JsonHelper.Deserialize<string[]>(options);
                /// to test maybe is not an integer but a JSONObject
                EntryExecuteStatment entryExecute = JSON.JsonHelper.Deserialize<EntryExecuteStatment>(args[0]);
                string query = entryExecute.query;
                /// to test not sure that's work
                List<object> param = entryExecute.param;
                callbackId = args[1];

                if (mbTilesActions != null && mbTilesActions.isOpen())
                {
                    string result = mbTilesActions.executeStatment(query, param);
                    PluginResult pluginResult = new PluginResult(PluginResult.Status.OK);
                    pluginResult.Message = result;
                    DispatchCommandResult(pluginResult, callbackId);
                }
                else
                {
                    DispatchCommandResult(new PluginResult(PluginResult.Status.IO_EXCEPTION), callbackId);
                }

            }
            catch (Exception)
            {
                DispatchCommandResult(new PluginResult(PluginResult.Status.JSON_EXCEPTION));
            }
        }
开发者ID:keyz182,项目名称:cordova-plugin-mbtiles,代码行数:33,代码来源:MBTilesPlugin.cs

示例3: close

 public void close(string options = "")
 {
     if (browser != null)
     {
         Deployment.Current.Dispatcher.BeginInvoke(() =>
         {
             PhoneApplicationFrame frame = Application.Current.RootVisual as PhoneApplicationFrame;
             if (frame != null)
             {
                 PhoneApplicationPage page = frame.Content as PhoneApplicationPage;
                 if (page != null)
                 {
                     Grid grid = page.FindName("LayoutRoot") as Grid;
                     if (grid != null)
                     {
                         grid.Children.Remove(browser);
                     }
                     page.ApplicationBar = null;
                 }
             }
             browser = null;
             string message = "{\"type\":\"exit\"}";
             PluginResult result = new PluginResult(PluginResult.Status.OK, message);
             result.KeepCallback = false;
             this.DispatchCommandResult(result);
         });
     }
 }
开发者ID:ChristianWeyer,项目名称:tUdUs,代码行数:28,代码来源:InAppBrowser.cs

示例4: Reclaim

        async public void Reclaim(string options)
        {
            PluginResult result;

            if (barcodeScanner != null)
            {
                claimedBarcodeScanner = await barcodeScanner.ClaimScannerAsync();

                if (claimedBarcodeScanner != null)
                {
                    await claimedBarcodeScanner.EnableAsync();
                    claimedBarcodeScanner.DataReceived += DataReceived;

                    result = new PluginResult(PluginResult.Status.NO_RESULT);
                    result.KeepCallback = true;
                }
                else
                {
                    result = new PluginResult(PluginResult.Status.ERROR, "Barcode Scanner could not get claimed");
                }
            }
            else
            {
                result = new PluginResult(PluginResult.Status.ERROR, "Barcode Scanner Object not exists");
            }

            DispatchCommandResult(result);
        }
开发者ID:grs-software,项目名称:cordova-wpe8-barcode-scanner,代码行数:28,代码来源:BarcodeScanner.cs

示例5: pickContact

        public void pickContact(string arguments)
        {
            string[] args = JSON.JsonHelper.Deserialize<string[]>(arguments);

            // Use custom contact picker because WP8 api doesn't provide its' own
            // contact picker, only PhoneNumberChooser or EmailAddressChooserTask
            var task = new ContactPickerTask();
            var desiredFields = JSON.JsonHelper.Deserialize<string[]>(args[0]);

            task.Completed += delegate(Object sender, ContactPickerTask.PickResult e)
                {
                    if (e.TaskResult == TaskResult.OK)
                    {
                        string strResult = e.Contact.ToJson(desiredFields);
                        var result = new PluginResult(PluginResult.Status.OK)
                            {
                                Message = strResult
                            };
                        DispatchCommandResult(result);
                    }
                    if (e.TaskResult == TaskResult.Cancel)
                    {
                        DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, "Operation cancelled."));
                    }
                };

            task.Show();
        }
开发者ID:Bettogc,项目名称:frenzyApp,代码行数:28,代码来源:Contacts.cs

示例6: start

        public void start(string options)
        {
            // Register power changed event handler
            DeviceStatus.PowerSourceChanged += powerChanged;

            PluginResult result = new PluginResult(PluginResult.Status.NO_RESULT);
            result.KeepCallback = true;
            DispatchCommandResult(result);
        }
开发者ID:surfingonrails,项目名称:GoogleHack4Good,代码行数:9,代码来源:Battery.cs

示例7: DispatchCommandResult

        public void DispatchCommandResult(PluginResult result)
        {
            if (this.OnCommandResult != null)
            {
                this.OnCommandResult(this, result);
                this.OnCommandResult = null;

            }
        }
开发者ID:cyrix4,项目名称:phonegap-wp7,代码行数:9,代码来源:BaseCommand.cs

示例8: start

 public void start(string options)
 {
     // Register power changed event handler
     DeviceStatus.PowerSourceChanged += powerChanged;
     #if WP8
     battery.RemainingChargePercentChanged += Battery_RemainingChargePercentChanged;
     #endif
     PluginResult result = new PluginResult(PluginResult.Status.NO_RESULT);
     result.KeepCallback = true;
     DispatchCommandResult(result);
 }
开发者ID:polyvi,项目名称:cordova-plugin-battery-status,代码行数:11,代码来源:Battery.cs

示例9: DispatchCommandResult

        public void DispatchCommandResult(PluginResult result)
        {
            if (this.OnCommandResult != null)
            {
                this.OnCommandResult(this, result);

                if (!result.KeepCallback)
                {
                    this.Dispose();
                }

            }
        }
开发者ID:rudolfo,项目名称:phonegap,代码行数:13,代码来源:BaseCommand.cs

示例10: Method

        public void Method(string options)
        {
            string upperCase = JSON.JsonHelper.Deserialize<string[]>(options)[0].ToUpper();
            PluginResult result;
            if (upperCase != "")
            {
                result = new PluginResult(PluginResult.Status.OK, upperCase);
            } else
            {
                result = new PluginResult(PluginResult.Status.ERROR, upperCase);
            }

            DispatchCommandResult(result);
        }
开发者ID:bozood,项目名称:MobileDay,代码行数:14,代码来源:MyPlugin.cs

示例11: download

        public void download(string options)
        {
            string url;
            string filePath;
            string callbackId;

            try
            {
                url = JSON.JsonHelper.Deserialize<string[]>(options)[0];
                filePath = JSON.JsonHelper.Deserialize<string[]>(options)[1];
                callbackId = JSON.JsonHelper.Deserialize<string[]>(options)[2];
            }
            catch (ArgumentException ex)
            {
                XLog.WriteError("download arguments occur Exception JSON_EXCEPTION " + ex.Message);
                DispatchCommandResult(new PluginResult(PluginResult.Status.JSON_EXCEPTION));
                return;
            }

            string workspace = this.app.GetWorkSpace();
            string target = XUtils.ResolvePath(workspace, filePath);
            if (null == target)
            {
                FileTransfer.FileTransferError error = new FileTransfer.FileTransferError(FILE_NOT_FOUND_ERR, url, filePath, 0);
                PluginResult result = new PluginResult(PluginResult.Status.ERROR, error);
                DispatchCommandResult(result);
                return;
            }

            String abstarget = XUtils.BuildabsPathOnIsolatedStorage(target);
            if (!url.StartsWith("http://"))
            {
                FileTransfer.FileTransferError error = new FileTransfer.FileTransferError(INVALID_URL_ERR, url, filePath, 0);
                PluginResult result = new PluginResult(PluginResult.Status.ERROR, error);
                DispatchCommandResult(result);
                return;
            }

            EventHandler<PluginResult> DispatchPluginResult = delegate(object sender, PluginResult result)
            {
                DispatchCommandResult(result, callbackId);
            };

            FileTransferManager.AddFileTranferTask(url, abstarget, workspace,
                    DispatchPluginResult, COMMAND_DOWNLOAD);
        }
开发者ID:polyvi,项目名称:xface-extension-advanced-file-transfer,代码行数:46,代码来源:XAdvancedFileTransferExt.cs

示例12: Band

        public void Band(string options)
        {
            string title = "";
            string message = "";

            string[] args  = JSON.JsonHelper.Deserialize<string[]>(options);
            title = args[0].ToString();
            message = args[1].ToString();

            PluginResult result;
            if (title != "" && message != "")
            {
                result = new PluginResult(PluginResult.Status.OK, args);
            } else
            {
                result = new PluginResult(PluginResult.Status.ERROR, args);
            }

            DispatchCommandResult(result);
        }
开发者ID:elio00728,项目名称:BandPlugin,代码行数:20,代码来源:BandPlugin.cs

示例13: TaskCompleted

        /// <summary>
        /// Handler for barcode scanner task.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The scan result.</param>
        private void TaskCompleted(object sender, BarcodeScannerTask.ScanResult e)
        {
            PluginResult result;

            switch (e.TaskResult)
            {
                case TaskResult.OK:
                    result = new PluginResult(PluginResult.Status.OK);
                    result.Message = JsonHelper.Serialize(new BarcodeResult(e.Barcode));
                    break;
                case TaskResult.Cancel:
                    // If scan is cancelled we return PluginResult.Status.OK with Message contains cancelled: true
                    // See plugin docs https://github.com/MSOpenTech/BarcodeScanner#using-the-plugin
                    result = new PluginResult(PluginResult.Status.OK);
                    result.Message = JsonHelper.Serialize(new BarcodeResult());
                    break;
                default:
                    result = new PluginResult(PluginResult.Status.ERROR);
                    break;
            }

            this.DispatchCommandResult(result);
        }
开发者ID:CareWB,项目名称:WeX5,代码行数:28,代码来源:BarcodeScanner.cs

示例14: Enable

        async public void Enable(string options)
        {
            PluginResult result;

            if (barcodeScanner == null)
            {
                barcodeScanner = await Windows.Devices.PointOfService.BarcodeScanner.GetDefaultAsync();

                if (claimedBarcodeScanner == null)
                {
                    claimedBarcodeScanner = await barcodeScanner.ClaimScannerAsync();

                    if (claimedBarcodeScanner != null)
                    {
                        await claimedBarcodeScanner.EnableAsync();
                        claimedBarcodeScanner.DataReceived += DataReceived;

                        result = new PluginResult(PluginResult.Status.NO_RESULT);
                        result.KeepCallback = true;
                    }
                    else
                    {
                        result = new PluginResult(PluginResult.Status.ERROR, "Barcode Scanner could not get claimed");
                    }
                }
                else
                {
                    result = new PluginResult(PluginResult.Status.ERROR, "Claimed Barcode Scanner Object already there");
                }
            }
            else
            {
                result = new PluginResult(PluginResult.Status.ERROR, "Barcode Scanner Object already there");
            }

            DispatchCommandResult(result);
        }
开发者ID:grs-software,项目名称:cordova-wpe8-barcode-scanner,代码行数:37,代码来源:BarcodeScanner.cs

示例15: browser_Navigating

 void browser_Navigating(object sender, NavigatingEventArgs e)
 {
     string message = "{\"type\":\"loadstart\",\"url\":\"" + e.Uri.OriginalString + "\"}";
     PluginResult result = new PluginResult(PluginResult.Status.OK, message);
     result.KeepCallback = true;
     this.DispatchCommandResult(result, NavigationCallbackId);
 }
开发者ID:maveriklko9719,项目名称:iOS-NativeApp,代码行数:7,代码来源:InAppBrowser.cs


注:本文中的PluginResult类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。