private bool GetDefaults(string options)
        {
            try
            {
                _dateTimePickerOptions = new DateTimePickerOptions();
                var args  = JsonHelper.Deserialize <string[]>(options);
                var value = args[0];
                var step  = args.Length > 2 ? args[1] : null;
                _callbackId = args[args.Length - 1];

                if (!String.IsNullOrEmpty(value))
                {
                    _dateTimePickerOptions.Value = FromUnixTime(long.Parse(value));
                }
                if (!String.IsNullOrEmpty(step))
                {
                    _dateTimePickerOptions.Step = int.Parse(step);
                }
            }
            catch (Exception ex)
            {
                DispatchCommandResult(new PluginResult(PluginResult.Status.JSON_EXCEPTION, ex.Message), _callbackId);
                return(false);
            }
            return(true);
        }
예제 #2
0
        /// <summary>
        /// Triggers  special UI to select a time (hour/minute/am/pm).
        /// </summary>
        public void selectTime(string options)
        {
            try
            {
                try
                {
                    this.dateTimePickerOptions = String.IsNullOrEmpty(options) ? new DateTimePickerOptions() :
                       CordovaClassLib.Cordova.JSON.JsonHelper.Deserialize<DateTimePickerOptions>(options);

                }
                catch (Exception ex)
                {
                    this.DispatchCommandResult(new CordovaClassLib.Cordova.PluginResult(CordovaClassLib.Cordova.PluginResult.Status.JSON_EXCEPTION, ex.Message));
                    return;
                }

                this.dateTimePickerTask = new DateTimePickerTask();
                dateTimePickerTask.Value = dateTimePickerOptions.Value;

                dateTimePickerTask.Completed += this.dateTimePickerTask_Completed;
                dateTimePickerTask.Show(DateTimePickerTask.DateTimePickerType.Time);
            }
            catch (Exception e)
            {
                DispatchCommandResult(new CordovaClassLib.Cordova.PluginResult(CordovaClassLib.Cordova.PluginResult.Status.ERROR, e.Message));
            }
        }
        private bool GetDefaults(string options)
        {
            try
            {
                _dateTimePickerOptions = new DateTimePickerOptions();
                var args = JSON.JsonHelper.Deserialize<string[]>(options);
                var value = args[0];
                var step = args.Length > 2 ? args[1] : null;

                if (!String.IsNullOrEmpty(value))
                {
                    _dateTimePickerOptions.Value = FromUnixTime(long.Parse(value));
                }
                if (!String.IsNullOrEmpty(step))
                {
                     _dateTimePickerOptions.Step = int.Parse(step);
                }
            }
            catch (Exception ex)
            {
                DispatchCommandResult(new PluginResult(PluginResult.Status.JSON_EXCEPTION, ex.Message));
                return false;
            }
            return true;
        }
        /// <summary>
        /// Triggers  special UI to select a date (day/month/year)
        /// </summary>
        public void selectDate(string options)
        {
            try {
                try
                {
                    string value = WPCordovaClassLib.Cordova.JSON.JsonHelper.Deserialize <string[]>(options)[0];
                    dateTimePickerOptions = new DateTimePickerOptions();
                    if (!String.IsNullOrEmpty(value))
                    {
                        dateTimePickerOptions.Value = FromUnixTime(long.Parse(value));
                    }

                    //this.dateTimePickerOptions = String.IsNullOrEmpty(options["value"]) ? new DateTimePickerOptions() :
                    //    WPCordovaClassLib.Cordova.JSON.JsonHelper.Deserialize<DateTimePickerOptions>(options);
                }
                catch (Exception ex)
                {
                    this.DispatchCommandResult(new PluginResult(PluginResult.Status.JSON_EXCEPTION, ex.Message));
                    return;
                }

                this.dateTimePickerTask  = new DateTimePickerTask();
                dateTimePickerTask.Value = dateTimePickerOptions.Value;

                dateTimePickerTask.Completed += this.dateTimePickerTask_Completed;
                dateTimePickerTask.Show(DateTimePickerTask.DateTimePickerType.Date);
            }
            catch (Exception e)
            {
                DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, e.Message));
            }
        }
예제 #5
0
        /// <summary>
        /// Triggers  special UI to select a date (day/month/year)
        /// </summary>
        public void selectDate(string options)
        {
            try
            {
                try
                {
                    this.dateTimePickerOptions = String.IsNullOrEmpty(options) ? new DateTimePickerOptions() :
                                                 WP7GapClassLib.PhoneGap.JSON.JsonHelper.Deserialize <DateTimePickerOptions>(options);
                }
                catch (Exception ex)
                {
                    this.DispatchCommandResult(new PluginResult(PluginResult.Status.JSON_EXCEPTION, ex.Message));
                    return;
                }

                this.dateTimePickerTask  = new DateTimePickerTask();
                dateTimePickerTask.Value = dateTimePickerOptions.Value;

                dateTimePickerTask.Completed += this.dateTimePickerTask_Completed;
                dateTimePickerTask.Show(DateTimePickerTask.DateTimePickerType.Date);
            }
            catch (Exception e)
            {
                DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, e.Message));
            }
        }
        /// <summary>
        /// Triggers  special UI to select a date (day/month/year)
        /// </summary>
        public void selectDate(string options)
        {
            try {

                try
                {

                    string value = WPCordovaClassLib.Cordova.JSON.JsonHelper.Deserialize<string[]>(options)[0];
                    dateTimePickerOptions = new DateTimePickerOptions();
                    if(!String.IsNullOrEmpty(value)) {
                        dateTimePickerOptions.Value = FromUnixTime(long.Parse(value));
                    }

                    //this.dateTimePickerOptions = String.IsNullOrEmpty(options["value"]) ? new DateTimePickerOptions() :
                    //    WPCordovaClassLib.Cordova.JSON.JsonHelper.Deserialize<DateTimePickerOptions>(options);

                }
                catch (Exception ex)
                {
                    this.DispatchCommandResult(new PluginResult(PluginResult.Status.JSON_EXCEPTION, ex.Message));
                    return;
                }

                this.dateTimePickerTask = new DateTimePickerTask();
                dateTimePickerTask.Value = dateTimePickerOptions.Value;

                dateTimePickerTask.Completed += this.dateTimePickerTask_Completed;
                dateTimePickerTask.Show(DateTimePickerTask.DateTimePickerType.Date);
            }
            catch (Exception e)
            {
                DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, e.Message));
            }
        }
예제 #7
0
        /// <summary>
        /// Triggers  special UI to select a date (day/month/year)
        /// </summary>
        public void selectDate(string options)
        {
            try {
                try
                {
                    var args = JSON.JsonHelper.Deserialize <string[]>(options);
                    _callbackId = args[args.Length - 1];
                    if (ResultHandlers.ContainsKey(CurrentCommandCallbackId))
                    {
                        mySavedHandler = ResultHandlers[CurrentCommandCallbackId];
                    }
                    string value = WPCordovaClassLib.Cordova.JSON.JsonHelper.Deserialize <string[]>(options)[0];
                    dateTimePickerOptions = new DateTimePickerOptions();
                    if (!String.IsNullOrEmpty(value))
                    {
                        dateTimePickerOptions.Value = FromUnixTime(long.Parse(value));
                    }

                    //this.dateTimePickerOptions = String.IsNullOrEmpty(options["value"]) ? new DateTimePickerOptions() :
                    //    WPCordovaClassLib.Cordova.JSON.JsonHelper.Deserialize<DateTimePickerOptions>(options);
                }
                catch (Exception ex)
                {
                    this.DispatchCommandResult(new PluginResult(PluginResult.Status.JSON_EXCEPTION, ex.Message));
                    return;
                }

                this.dateTimePickerTask  = new DateTimePickerTask();
                dateTimePickerTask.Value = dateTimePickerOptions.Value;

                dateTimePickerTask.Completed += this.dateTimePickerTask_Completed;
                dateTimePickerTask.Show(DateTimePickerTask.DateTimePickerType.Date);
            }
            catch (Exception e)
            {
                DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, e.Message));
            }
        }