Ejemplo n.º 1
0
        void loadCharts()
        {
            TKChartNumericAxis yAxis = new TKChartNumericAxis();

            yAxis.Range = new TKRange(new NSNumber(250), new NSNumber(750));
            yAxis.Style.LabelStyle.TextAlignment           = TKChartAxisLabelAlignment.Right | TKChartAxisLabelAlignment.Bottom;
            yAxis.Style.LabelStyle.FirstLabelTextAlignment = TKChartAxisLabelAlignment.Right | TKChartAxisLabelAlignment.Top;
            yAxis.AllowZoom = true;
            yAxis.AllowPan  = true;
            series.YAxis    = yAxis;

            NSDateFormatter formatter = new NSDateFormatter();

            formatter.DateFormat = "MM/dd/yyyy";

            NSDate minDate            = formatter.Parse("01/01/2011");
            NSDate maxDate            = formatter.Parse("01/01/2013");
            TKChartDateTimeAxis xAxis = new TKChartDateTimeAxis();

            xAxis.Range = new TKRange(minDate, maxDate);
            xAxis.MinorTickIntervalUnit                    = TKChartDateTimeAxisIntervalUnit.Days;
            xAxis.MajorTickIntervalUnit                    = TKChartDateTimeAxisIntervalUnit.Years;
            xAxis.MajorTickInterval                        = 1;
            xAxis.Style.MajorTickStyle.TicksHidden         = false;
            xAxis.Style.MajorTickStyle.TicksOffset         = -3;
            xAxis.Style.MajorTickStyle.TicksWidth          = 1.5f;
            xAxis.Style.MajorTickStyle.MaxTickClippingMode = TKChartAxisClippingMode.Visible;
            xAxis.Style.MajorTickStyle.TicksFill           = new TKSolidFill(UIColor.FromRGB(203 / 255.0f, 203 / 255.0f, 203 / 255.0f));
            xAxis.AllowZoom = true;
            xAxis.AllowPan  = true;
            series.XAxis    = xAxis;

            AddTrendline(new TKChartSimpleMovingAverageIndicator(this.series));
            AddIndicator(new TKChartPercentageVolumeOscillator(this.series));
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();
            NSDateFormatter dateFormatter = new NSDateFormatter { DateFormat = "dd-MM-yyyy" };

            // Create the chart
            View.BackgroundColor = UIColor.White;
            nfloat margin = UserInterfaceIdiomIsPhone ? 10 : 50;
            CGRect frame = new CGRect (margin, margin, View.Bounds.Width - 2 * margin, View.Bounds.Height - 2 * margin);
            chart = new ShinobiChart (frame) {
                Title = "Apple Stock Pirce",
                AutoresizingMask = ~UIViewAutoresizing.None,

                LicenseKey = "", // TODO: add your trail license key here!

                // add X & Y axes, with explicit ranges so that the chart is initially rendered 'zoomed in'
                XAxis = new SChartDateTimeAxis(new SChartDateRange(dateFormatter.Parse("01-01-2010"), dateFormatter.Parse("01-06-2010"))) {
                    Title = "Date",
                    EnableGesturePanning = true,
                    EnableGestureZooming = true
                },

                YAxis = new SChartNumberAxis(new SChartNumberRange(150, 300)) {
                    Title = "Price (USD)",
                    EnableGesturePanning = true,
                    EnableGestureZooming = true
                },

                DataSource = new MultipleAxesDataSource(),
                Delegate = new MultipleAxesDelegate()
            };

            // Add a secondary y-axis for volume
            SChartNumberAxis volumeAxis = new SChartNumberAxis {
                // Render on the right-hand side
                AxisPosition = SChartAxisPosition.Reverse,
                Title = "Volume",
                // Add an upper padding so that the volume chart occupies the bottom hald of the plot area
                RangePaddingHigh = new NSNumber(100)
            };

            NSNumberFormatter volumeFormatter = (volumeAxis.LabelFormatter.Formatter as NSNumberFormatter);
            volumeFormatter.MaximumFractionDigits = 0;
            volumeFormatter.PositiveSuffix = "M";
            volumeFormatter.NegativeSuffix = "M";

            // Hide gridlines
            volumeAxis.Style.MajorGridLineStyle.ShowMajorGridLines = false;
            chart.AddYAxis (volumeAxis);

            View.AddSubview (chart);
        }
        public static void ShowNotification(Models.Notification _Notification)
        {
            if (DateTime.ParseExact(_Notification.START_DATE, Constants.TIME_FORMAT, null) > DateTime.Now)
            {
                var             HUINotification = new UILocalNotification();
                NSDateFormatter HFormatter      = new NSDateFormatter();
                HFormatter.DateFormat       = Params.Constants.TIME_FORMAT;
                HUINotification.FireDate    = HFormatter.Parse(_Notification.START_DATE);
                HUINotification.AlertTitle  = _Notification.CAPTION;
                HUINotification.AlertBody   = _Notification.DESCRIPTION;
                HUINotification.AlertAction = "ViewAlert";

                NSMutableDictionary HCustomDictionary = new NSMutableDictionary();

                HCustomDictionary.SetValueForKey(new NSNumber(_Notification.EVENT_IDENT != -1), new NSString("BY_EVENT"));
                if (_Notification.EVENT_IDENT != -1)
                {
                    HCustomDictionary.SetValueForKey(new NSNumber(_Notification.EVENT_IDENT), new NSString("EVENT_IDENT"));
                }
                else
                {
                    if (_Notification.EVENT_DATE != "")
                    {
                        HCustomDictionary.SetValueForKey(new NSString(_Notification.EVENT_DATE), new NSString("START_DATE"));
                    }
                }
                HUINotification.UserInfo = HCustomDictionary;
                UIApplication.SharedApplication.ScheduleLocalNotification(HUINotification);
            }
        }
Ejemplo n.º 4
0
 public MultipleAxesDataSource()
     : base()
 {
     NSDateFormatter dateFormatter = new NSDateFormatter { DateFormat = "dd-MM-yyyy" };
     JsonValue stocks = JsonObject.Load(new StreamReader("./AppleStockPrices.json"));
     foreach (JsonValue stock in stocks) {
         _timeSeries.Add (new SChartDataPoint {
             XValue = dateFormatter.Parse(stock["date"]),
             YValue = new NSNumber((double)stock["close"]),
         });
         _volumeSeries.Add (new SChartDataPoint {
             XValue = dateFormatter.Parse(stock["date"]),
             YValue = new NSNumber((double)stock["volume"] / 1000000.0),
         });
     };
 }
Ejemplo n.º 5
0
        private NSDate CambiarFormato()
        {
            NSDateFormatter dateFormat = new NSDateFormatter();

            dateFormat.DateFormat = "HH:mm";
            return(dateFormat.Parse(MinDate));
        }
Ejemplo n.º 6
0
        public static List <StockDataPoint> LoadStockPoints(int maxItems)
        {
            List <StockDataPoint> stockPoints = new List <StockDataPoint> ();

            string          filePath  = NSBundle.MainBundle.PathForResource("AppleStockPrices", "json");
            NSData          json      = NSData.FromFile(filePath);
            NSError         error     = new NSError();
            NSArray         data      = (NSArray)NSJsonSerialization.Deserialize(json, NSJsonReadingOptions.AllowFragments, out error);
            NSDateFormatter formatter = new NSDateFormatter();

            formatter.DateFormat = "dd-MM-yyyy";

            for (int i = 0; i < (int)data.Count; i++)
            {
                if (i == maxItems)
                {
                    break;
                }
                NSDictionary   jsonPoint = data.GetItem <NSDictionary> ((nuint)i);
                StockDataPoint dataPoint = new StockDataPoint();
                dataPoint.DataXValue = formatter.Parse((NSString)jsonPoint ["date"]);
                dataPoint.Open       = (NSNumber)jsonPoint ["open"];
                dataPoint.Low        = (NSNumber)jsonPoint ["low"];
                dataPoint.Close      = (NSNumber)jsonPoint ["close"];
                dataPoint.Volume     = (NSNumber)jsonPoint ["volume"];
                dataPoint.High       = (NSNumber)jsonPoint ["high"];
                stockPoints.Add(dataPoint);
            }

            return(stockPoints);
        }
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ///
        /// Member functions of the class
        ///
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////

        #region Member Functions

        /// Purpose: Draw the chart of Umsatz
        // Example: -
        void GetData()
        {
            PersonUmsatzList = _person.GetPersonTimeUmsatz("36", ref Application._user);
            NSDateFormatter dateFormatter = new NSDateFormatter { DateFormat = "dd-MM-yyyy" };

            for (int i = 0; i < PersonUmsatzList.Count; i++)
            {
                DateTime date = DateTime.ParseExact(PersonUmsatzList[i].Date, "yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture);
                if (date.Year == 4028)
                    date =  date.AddYears(-2016);

                if (date.Year > 2015 || date.Year < 2013)
                    Console.WriteLine("*********************** Wrong Year ******************************");


                double closePrice = Double.Parse(PersonUmsatzList[i].Umsatz);
                SChartDataPoint dataPoint = new SChartDataPoint();
                dataPoint.XValue = new NSString("");

                string dateString = date.Day.ToString() + "-" + date.Month.ToString() + "-" + date.Year.ToString();
//                Console.WriteLine(dateString);
                                            
                dataPoint.XValue = dateFormatter.Parse(dateString.ToString());
                Console.WriteLine(dataPoint.XValue.ToString());

//                dataPoint.XValue =dateFormatter.Parse( date.ToString());
                dataPoint.YValue = new NSNumber(closePrice);// new NSString( closePrice.ToString());
                dataPoints.Add(dataPoint);
            }
                
        }
Ejemplo n.º 8
0
		public static List<StockDataPoint> LoadStockPoints(int maxItems)
		{
			List<StockDataPoint> stockPoints = new List<StockDataPoint> ();

			string filePath = NSBundle.MainBundle.PathForResource ("AppleStockPrices", "json");
			NSData json = NSData.FromFile (filePath);
			NSError error = new NSError ();
			NSArray data = (NSArray)NSJsonSerialization.Deserialize (json, NSJsonReadingOptions.AllowFragments, out error);
			NSDateFormatter formatter = new NSDateFormatter ();
			formatter.DateFormat = "dd-MM-yyyy";

			for (int i = 0; i < (int)data.Count; i++) {
				if (i == maxItems) {
					break;
				}
				NSDictionary jsonPoint = data.GetItem<NSDictionary> ((nuint)i);
				StockDataPoint dataPoint = new StockDataPoint ();
				dataPoint.DataXValue = formatter.Parse ((NSString)jsonPoint ["date"]);
				dataPoint.Open = (NSNumber)jsonPoint ["open"];
				dataPoint.Low = (NSNumber)jsonPoint ["low"];
				dataPoint.Close = (NSNumber)jsonPoint ["close"];
				dataPoint.Volume = (NSNumber)jsonPoint ["volume"];
				dataPoint.High = (NSNumber)jsonPoint ["high"];
				stockPoints.Add (dataPoint);
			}

			return stockPoints;
		}
Ejemplo n.º 9
0
        private void GenerarEvento(SalaJuntasReservacionModel Reservaciones)
        {
            RequestAccess(EKEntityType.Event, () =>
            {
                CLLocation location = new CLLocation();
                if (Reservaciones.Sucursal_Id == "1")
                {
                    location = new CLLocation(20.6766, -103.3812);
                }
                else
                {
                    location = new CLLocation(20.6766, -103.3812);
                }
                var structuredLocation         = new EKStructuredLocation();
                structuredLocation.Title       = Reservaciones.Sucursal_Domicilio;
                structuredLocation.GeoLocation = location;

                NSDateFormatter dateFormat = new NSDateFormatter();
                dateFormat.DateFormat      = "dd/MM/yyyy";
                NSDate newFormatDate       = dateFormat.Parse(Reservaciones.Sala_Fecha);

                EKEvent newEvent = EKEvent.FromStore(AppHelper.Current.EventStore);

                DateTime myDate = DateTime.ParseExact(Reservaciones.Sala_Fecha, "yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture);

                var arrTime          = Reservaciones.Sala_Hora_Inicio.Split(':');
                var hora             = (double.Parse(arrTime[0]) - 1);
                var minutos          = double.Parse(arrTime[1]);
                var newDate          = myDate.AddHours(hora);
                var newDate2         = newDate.AddMinutes(minutos);
                var HoraAntesReunion = newDate2;
                newEvent.AddAlarm(EKAlarm.FromDate(DateTimeToNSDate(HoraAntesReunion.AddMinutes(30))));
                newEvent.AddAlarm(EKAlarm.FromDate(DateTimeToNSDate(HoraAntesReunion.AddMinutes(45))));
                if (newDate2 != null)
                {
                    hora         = hora + 1;
                    var newDate3 = myDate.AddHours(hora);
                    var newDate4 = newDate3.AddMinutes(minutos);

                    var HoraInicio     = this.DateTimeToNSDate(newDate4);
                    newEvent.StartDate = HoraInicio;
                    arrTime            = Reservaciones.Sala_Hora_Fin.Split(':');
                    hora             = double.Parse(arrTime[0]);
                    minutos          = double.Parse(arrTime[1]);
                    var newDate5     = myDate.AddHours(hora);
                    var newDate6     = newDate5.AddMinutes(minutos);
                    newEvent.EndDate = this.DateTimeToNSDate(newDate6);
                }
                newEvent.Title              = "Reservación de sala de juntas en " + Reservaciones.Sucursal_Descripcion + ", en el piso " + Reservaciones.Sala_Nivel + ", en la sala " + Reservaciones.Sala_Descripcion;
                newEvent.Notes              = "Se recomienda presentarse 5 minutos antes de su hora de reservación";
                newEvent.Calendar           = AppHelper.Current.EventStore.DefaultCalendarForNewEvents;
                newEvent.Location           = Reservaciones.Sucursal_Domicilio;
                newEvent.StructuredLocation = structuredLocation;
                NSError e;
                AppHelper.Current.EventStore.SaveEvent(newEvent, EKSpan.ThisEvent, out e);
            });
        }
Ejemplo n.º 10
0
        void loadCharts()
        {
            overlayChart.RemoveAllData();
            indicatorsChart.RemoveAllData();

            TKChartNumericAxis yAxis = new TKChartNumericAxis();

            yAxis.Range = new TKRange(new NSNumber(250), new NSNumber(750));
            yAxis.Style.LabelStyle.TextAlignment           = TKChartAxisLabelAlignment.Right | TKChartAxisLabelAlignment.Bottom;
            yAxis.Style.LabelStyle.FirstLabelTextAlignment = TKChartAxisLabelAlignment.Right | TKChartAxisLabelAlignment.Top;
            yAxis.AllowZoom = true;
            yAxis.AllowPan  = true;
            series.YAxis    = yAxis;

            NSDateFormatter formatter = new NSDateFormatter();

            formatter.DateFormat = "MM/dd/yyyy";

            NSDate minDate            = formatter.Parse("01/01/2011");
            NSDate maxDate            = formatter.Parse("01/01/2013");
            TKChartDateTimeAxis xAxis = new TKChartDateTimeAxis();

            xAxis.Range = new TKRange(minDate, maxDate);
            xAxis.MinorTickIntervalUnit                    = TKChartDateTimeAxisIntervalUnit.Days;
            xAxis.MajorTickIntervalUnit                    = TKChartDateTimeAxisIntervalUnit.Years;
            xAxis.MajorTickInterval                        = 1;
            xAxis.Style.MajorTickStyle.TicksHidden         = false;
            xAxis.Style.MajorTickStyle.TicksOffset         = -3;
            xAxis.Style.MajorTickStyle.TicksWidth          = 1.5f;
            xAxis.Style.MajorTickStyle.MaxTickClippingMode = TKChartAxisClippingMode.Visible;
            xAxis.Style.MajorTickStyle.TicksFill           = new TKSolidFill(UIColor.FromRGB(203 / 255.0f, 203 / 255.0f, 203 / 255.0f));
            xAxis.AllowZoom = true;
            xAxis.AllowPan  = true;
            series.XAxis    = xAxis;

            OptionInfo info = Trendlines [SelectedTrendLine];

            info.Handler(info, EventArgs.Empty);

            info = Indicators [SelectedIndicator];
            info.Handler(info, EventArgs.Empty);
        }
 public AddingAnnotationsDataSource()
 {
     NSDateFormatter dateFormatter = new NSDateFormatter { DateFormat = "dd-MM-yyyy" };
     JsonValue stocks = JsonObject.Load(new StreamReader("./AppleStockPrices.json"));
     foreach (JsonValue stock in stocks) {
         timeSeries.Add (new SChartDataPoint {
             XValue = dateFormatter.Parse(stock["date"]),
             YValue = new NSNumber((double)stock["close"]),
         });
     };
 }
Ejemplo n.º 12
0
        public static string DateConverter4(string inputDate)
        {
            var formatter = new NSDateFormatter();

            formatter.DateFormat = "yyyy-MM-dd'T'HH:mm:ss";

            NSDate date = formatter.Parse(inputDate);

            formatter.DateFormat = "MM월 dd일";

            return(formatter.ToString(date));
        }
Ejemplo n.º 13
0
        private void Parse(NSData data)
        {
            try {
                var earthquakes = new List <Earthquake> ();

                var       dump = JsonValue.Parse(NSString.FromData(data, NSStringEncoding.UTF8)) as JsonObject;
                JsonValue featureCollection = dump ["features"];

                for (int i = 0; i < MaximumNumberOfEarthquakesToParse; i++)
                {
                    var currentEarthquake = new Earthquake();

                    var       earthquake           = featureCollection [i] as JsonObject;
                    JsonValue earthquakeProperties = earthquake ["properties"];
                    currentEarthquake.Magnitude   = NSNumber.FromFloat((float)earthquakeProperties ["mag"]);
                    currentEarthquake.USGSWebLink = new NSString((string)earthquakeProperties ["url"]);
                    currentEarthquake.Location    = new NSString((string)earthquakeProperties ["place"]);

                    //date and time in milliseconds since epoch
                    var    seconds = (Int64)earthquakeProperties ["time"];
                    var    date    = new DateTime(1970, 1, 1, 0, 0, 0).AddMilliseconds(seconds);
                    string str     = date.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss'Z'");
                    currentEarthquake.Date = dateFormatter.Parse(str);

                    JsonValue earthquakeGeometry = earthquake ["geometry"];
                    var       coordinates        = earthquakeGeometry ["coordinates"] as JsonArray;
                    currentEarthquake.Longitude = NSNumber.FromFloat(coordinates [0]);
                    currentEarthquake.Latitude  = NSNumber.FromFloat(coordinates [1]);

                    if (earthquakes.Count > SizeOfEarthquakesBatch)
                    {
                        AddEarthquakesToList(earthquakes);
                        earthquakes.Clear();
                    }
                    else
                    {
                        earthquakes.Add(currentEarthquake);
                    }
                }

                if (earthquakes.Count > 0)
                {
                    AddEarthquakesToList(earthquakes);
                }
            } catch (Exception e) {
                Console.WriteLine(e.StackTrace + e.Message);
                var userInfo = NSDictionary.FromObjectAndKey(new NSString("Error while parsing GeoJSON"),
                                                             NSError.LocalizedDescriptionKey);

                var parsingError = new NSError(new NSString(), 0, userInfo);
                InvokeOnMainThread(new Selector("HandleEarthquakesError:"), parsingError);
            }
        }
Ejemplo n.º 14
0
        public static NSDate GetDateFromString(string theString)
        {
            var temp    = theString.Split('T');
            var string1 = temp[0];

            var formatter = new NSDateFormatter();

            formatter.DateFormat = "yyyy-MM-dd";

            NSDate date = formatter.Parse(string1);

            return(date);
        }
Ejemplo n.º 15
0
        void loadData(JobCIS jobDetail)
        {
            ///string htmlString = "<html><body><p style='font-family:verdana;margin-left:10px;font-size:15px;'>The MonoTouch API supports two styles of event notification: the Objective-C style that uses a delegate class or the C# style using event notifications.\n\nThe C# style allows the user to add or remove event handlers at runtime by assigning to the events of properties of this class. Event handlers can be anyone of a method, an anonymous methods or a lambda expression. Using the C# style events or properties will override any manual settings to the Objective-C Delegate or WeakDelegate settings.\n\nThe Objective-C style requires the user to create a new class derived from UIWebViewDelegate class and assign it to the UIKit.Delegate property. Alternatively, for low-level control, by creating a class derived from NSObject which has every entry point properly decorated with an [Export] attribute. The instance of this object can then be assigned to the UIWebView.WeakDelegate property.</p><p><b>Hey</b> you. My <b>name </b> is <h1> Joe </h1></p> </body></html>";
            //string htmlString = "<html><body><p style='font-family:verdana;margin-left:10px;font-size:15px;'>The MonoTouch API supports two styles of event notification: the Objective-C style that uses a delegate class or the C# style using event notifications.\n\nThe C# style allows the user to add or remove event handlers at runtime by assigning to the events of properties of this class. Event handlers can be anyone of a method, an anonymous methods or a lambda expression. Using the C# style events or properties will override any manual settings to the Objective-C Delegate or WeakDelegate settings.\n\nThe Objective-C style requires the user to create a new class derived from UIWebViewDelegate class and assign it to the UIKit.Delegate property. Alternatively, for low-level control, by creating a class derived from NSObject which has every entry point properly decorated with an [Export] attribute. The instance of this object can then be assigned to the UIWebView.WeakDelegate property.</p><p><b>Hey</b> you. My <b>name </b> is <h1> Joe </h1></p> </body></html>";

            string endDate = "";

            if (!string.IsNullOrEmpty(jobDetail.PostingEndDate))
            {
                string[] tokens = jobDetail.PostingEndDate.Split(new[] { " " }, StringSplitOptions.None);
                endDate = tokens[0];
            }
            else if (!string.IsNullOrEmpty(jobDetail.PostedDate))
            {
                string[] tokens = jobDetail.PostedDate.Split(new[] { " " }, StringSplitOptions.None);
                endDate = tokens[0];
            }


            NSDateFormatter dateFormat = new NSDateFormatter();

            dateFormat.DateFormat = "MM/dd/yyyy";
            NSDate date = dateFormat.Parse(endDate);

            DateTime dt = ConvertNsDateToDateTime(date);

            endDate = calculateJobPostedDate(dt);

            if (!string.IsNullOrEmpty(endDate) && !(endDate.Equals("NoContent")))
            {
                this.PostedDateLabel.Text = endDate;
            }
            else
            {
                this.PostedDateLabel.Hidden = true;
                this.btnPostedDate.Hidden   = true;
            }

            //var htmlString = String.Format("<html><body><p style='font-family:verdana;margin-left:10px;font-size:13px;’> {0} </p></body></html>", jobDetail.Description);
            //= String.Format("<font face='Helvetica' size='2'> {0}", jobDetail.Description);

            if (!string.IsNullOrEmpty(jobDetail.Description))
            {
                var htmlString = String.Format("<font face='Helvetica' size='2'> {0}", jobDetail.Description);
                webView.LoadHtmlString(htmlString, null);
            }
            else
            {
                webView.LoadHtmlString(string.Format("<html><center><font size=+5 color='red'>An error occurred:<br></font></center></html>"), null);
            }
        }
        public static NSDictionary <NSString, NSObject> Convert(this TimeTrackerApp.Services.IIdentifiable item)
        {
            var dict = new NSMutableDictionary <NSString, NSObject>();

            var jsonStr      = Newtonsoft.Json.JsonConvert.SerializeObject(item);
            var propertyDict = Newtonsoft.Json.JsonConvert.DeserializeObject <Dictionary <string, object> >(jsonStr);

            foreach (var key in propertyDict.Keys)
            {
                if (key.Equals("ID"))
                {
                    continue;
                }

                var      nsKey = new NSString(key);
                NSObject nsVal = null;
                var      value = propertyDict[key];
                if (value is string str)
                {
                    nsVal = new NSString(str);
                }
                else if (value is double dblVal)
                {
                    nsVal = new NSNumber(dblVal);
                }
                else if (value is bool boolVal)
                {
                    nsVal = new NSNumber(boolVal);
                }
                else if (Int32.TryParse(value.ToString(), out int intVal))
                {
                    nsVal = new NSNumber(intVal);
                }
                else if (value is DateTime dtVal)
                {
                    var formatter  = new NSDateFormatter();
                    var dateFormat = "yyyy-MM-ddHH:mm:ss";
                    formatter.DateFormat = dateFormat;
                    var dtStr = dtVal.ToString(dateFormat);
                    nsVal = formatter.Parse(dtStr);
                }

                if (nsVal != null)
                {
                    dict.Add(nsKey, nsVal);
                }
            }
            return(NSDictionary <NSString, NSObject> .FromObjectsAndKeys(dict.Values, dict.Keys));
        }
 public CandlestickChartDataSource()
 {
     NSDateFormatter dateFormatter = new NSDateFormatter { DateFormat = "dd-MM-yyyy" };
     JsonValue stocks = JsonObject.Load(new StreamReader("./AppleStockPrices.json"));
     foreach (JsonValue stock in stocks) {
         timeSeries.Add (new SChartMultiYDataPoint {
             XValue = dateFormatter.Parse(stock["date"]),
             YValues = new NSMutableDictionary() {
                 { new NSString(SChartCandlestickSeries.KeyOpen), new NSNumber((double)stock["open"]) },
                 { new NSString(SChartCandlestickSeries.KeyHigh), new NSNumber((double)stock["high"]) },
                 { new NSString(SChartCandlestickSeries.KeyLow), new NSNumber((double)stock["low"]) },
                 { new NSString(SChartCandlestickSeries.KeyClose), new NSNumber((double)stock["close"]) },
             }
         });
     };
 }
Ejemplo n.º 18
0
        private void GenerarEvento()
        {
            RequestAccess(EKEntityType.Event, () =>
            {
                CLLocation location = new CLLocation();
                if (SucursalModel.Sucursal_Id == "1")
                {
                    location = new CLLocation(20.6766, -103.3812);
                }
                else
                {
                    location = new CLLocation(20.6766, -103.3812);
                }
                var structuredLocation         = new EKStructuredLocation();
                structuredLocation.Title       = SucursalModel.Sucursal_Domicilio;
                structuredLocation.GeoLocation = location;

                NSDateFormatter dateFormat = new NSDateFormatter();
                dateFormat.DateFormat      = "E, d MMM yyyy HH:mm";
                NSDate newFormatDate       = dateFormat.Parse(this.FechaReservacion);
                EKEvent newEvent           = EKEvent.FromStore(AppHelper.Current.EventStore);

                DateTime myDate      = ((DateTime)newFormatDate).ToLocalTime();
                var HoraAntesReunion = myDate.AddHours(1 * -1);
                newEvent.AddAlarm(EKAlarm.FromDate(DateTimeToNSDate(HoraAntesReunion.AddMinutes(30))));
                newEvent.AddAlarm(EKAlarm.FromDate(DateTimeToNSDate(HoraAntesReunion.AddMinutes(45))));
                if (myDate != null)
                {
                    newEvent.StartDate = DateTimeToNSDate(myDate);
                    newEvent.EndDate   = DateTimeToNSDate(myDate.AddHours(1));
                }
                newEvent.Title = "Visita de invitados en " + SucursalModel.Sucursal_Descripcion;
                newEvent.Notes = "Invitados: ";
                foreach (UsuarioModel Invitado in InvitadosCalendar)
                {
                    newEvent.Notes = newEvent.Notes + Invitado.Usuario_Nombre + " " + Invitado.Usuario_Apellidos + ". ";
                }
                newEvent.Notes              = newEvent.Notes + " Asunto: " + Asunto;
                newEvent.Calendar           = AppHelper.Current.EventStore.DefaultCalendarForNewEvents;
                newEvent.Location           = SucursalModel.Sucursal_Domicilio;
                newEvent.StructuredLocation = structuredLocation;
                NSError e;
                AppHelper.Current.EventStore.SaveEvent(newEvent, EKSpan.ThisEvent, out e);
            });
        }
Ejemplo n.º 19
0
        partial void btnConfirmar_Touch(UIButton sender)
        {
            var OperacionTerminada = false;

            if (InternetConectionHelper.VerificarConexion())
            {
                DateTime myDate = DateTime.ParseExact(Reservacion.Sala_Fecha, "yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture);
                if (Reservacion.Sala_Hora_Inicio == "24:00")
                {
                    Reservacion.Sala_Hora_Inicio = "00:00";
                }

                if (Reservacion.Sala_Hora_Fin == "24:00")
                {
                    Reservacion.Sala_Hora_Fin = "00:00";
                }
                var asignacion = new SalasJuntasController().AsignarSalaJuntas("ALTA", Reservacion.Sala_Id, KeyChainHelper.GetKey("Usuario_Id"), KeyChainHelper.GetKey("Usuario_Tipo"), myDate, Reservacion.Sala_Hora_Inicio, Reservacion.Sala_Hora_Fin, Reservacion.Creditos_Usados.ToString());
                if (asignacion != -1)
                {
                    OperacionTerminada = true;
                }
                else
                {
                    OperacionTerminada = false;
                }
            }

            if (OperacionTerminada)
            {
                this.DismissViewController(true, () =>
                {
                    this.GenerarEvento(Reservacion);


                    NSDateFormatter dateFormat = new NSDateFormatter();
                    dateFormat.DateFormat      = "yyyy-MM-dd";
                    NSDate newFormatDate       = dateFormat.Parse(FechaReservacion);

                    this.EnviarMail(MenuHelper.Usuario, SalaActual, newFormatDate, Reservacion);

                    this.EventosReservacionesDelegate.ReservacionConfirmada(this.Reservacion);
                });
            }
        }
Ejemplo n.º 20
0
        private void AgendarSala()
        {
            var OperacionTerminada = false;

            if (InternetConectionHelper.VerificarConexion())
            {
                DateTime myDate = DateTime.ParseExact(Reservacion.Sala_Fecha, "yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture);
                if (Reservacion.Sala_Hora_Inicio == "24:00")
                {
                    Reservacion.Sala_Hora_Inicio = "00:00";
                }

                if (Reservacion.Sala_Hora_Fin == "24:00")
                {
                    Reservacion.Sala_Hora_Fin = "00:00";
                }
                var asignacion = new SalasJuntasController().AsignarSalaJuntas("ALTA", Reservacion.Sala_Id, KeyChainHelper.GetKey("Usuario_Id"), KeyChainHelper.GetKey("Usuario_Tipo"), myDate, Reservacion.Sala_Hora_Inicio, Reservacion.Sala_Hora_Fin, Reservacion.Creditos_Usados.ToString());
                if (asignacion != -1)
                {
                    OperacionTerminada = true;
                }
                else
                {
                    OperacionTerminada = false;
                }
            }

            if (OperacionTerminada)
            {
                this.GenerarEvento(Reservacion);
                NSDateFormatter dateFormat = new NSDateFormatter();
                dateFormat.DateFormat = "yyyy-MM-dd";
                NSDate newFormatDate = dateFormat.Parse(this.FechaSeleccionada);
                this.EnviarMail(MenuHelper.Usuario, SalaJuntasSeleccionada, newFormatDate, Reservacion);
                this.PerformSegue("Confirmacion", null);
            }
        }
Ejemplo n.º 21
0
        public void UpdateCell(JobCMS aJob)
        {
            this.titleLabel.Text    = aJob.JobTitle;
            this.LocationLabel.Text = aJob.JobLocation;
            //this.datePostedLabel.Hidden = true;

            if (!string.IsNullOrEmpty(aJob.Salary) && !(aJob.Salary.Equals("NoContent")))
            {
                this.ContractType.Text         = aJob.Salary;
                this.ContractTypeImgView.Image = UIImage.FromBundle("eurosymbol.png");
                //
            }
            else if (!string.IsNullOrEmpty(aJob.ContractTypeTitle) && !(aJob.ContractTypeTitle.Equals("NoContent")))
            {
                this.ContractType.Text         = aJob.ContractTypeTitle;
                this.ContractTypeImgView.Image = UIImage.FromBundle("calender-icon.png");
            }
            else
            {
                this.ContractType.Text         = "N/A";
                this.ContractTypeImgView.Image = UIImage.FromBundle("calender-icon.png");
                //this.expLable.Hidden = true;
                //this.expImgView.Hidden = tr
            }
            if (!string.IsNullOrEmpty(aJob.JobCategoryTitle) && !(aJob.JobCategoryTitle.Equals("NoContent")))
            {
                this.CategoryLabel.Text      = aJob.JobCategoryTitle;
                this.CategoryImageView.Image = UIImage.FromBundle("Truck.png");
            }
            else
            {
                this.CategoryLabel.Text      = "N/A";
                this.CategoryImageView.Image = UIImage.FromBundle("Truck.png");
                //this.expLable.Hidden = true;
                //this.expImgView.Hidden = tr
            }
            if (!string.IsNullOrEmpty(aJob.isExpiredorNew))
            {
                this.lblNew.Hidden             = false;
                this.lblNew.Layer.CornerRadius = 5.0f;
            }
            else
            {
                this.lblNew.Hidden = true;
            }

            //btnFavJob.Hidden = true;

            // iPhone 5 customization
            AppDelegate appDelegate = (AppDelegate)UIApplication.SharedApplication.Delegate;

            if (appDelegate.Window.Frame.Size.Width == 320 && appDelegate.Window.Frame.Size.Height == 568)
            {
                this.titleLabel.Frame      = new CGRect(5, 5, 270, 25);
                this.btnFavJob.Frame       = new CGRect(275, 5, 40, 40);
                this.datePostedLabel.Frame = new CGRect(220, 60, 95, 20);
            }
            else if (appDelegate.Window.Frame.Size.Width == 414)
            {                   // iPhone 6+
                this.titleLabel.Frame      = new CGRect(5, 5, 350, 25);
                this.btnFavJob.Frame       = new CGRect(360, 5, 40, 40);
                this.datePostedLabel.Frame = new CGRect(300, 60, 95, 20);
            }

            string endDate = "";

            if (!string.IsNullOrEmpty(aJob.PostedDate))
            {
                string[] tokens = aJob.PostedDate.Split(new[] { " " }, StringSplitOptions.None);
                endDate = tokens[0];
            }
            else if (!string.IsNullOrEmpty(aJob.PostingEndDate))
            {
                string[] tokens = aJob.PostingEndDate.Split(new[] { " " }, StringSplitOptions.None);
                endDate = tokens[0];
            }



            NSDateFormatter dateFormat = new NSDateFormatter();

            dateFormat.DateFormat = "MM/dd/yyyy";
            NSDate date = dateFormat.Parse(endDate);

            DateTime dt = ConvertNsDateToDateTime(date);

            endDate = calculateJobPostedDate(dt);


            if (!string.IsNullOrEmpty(endDate) && !(endDate.Equals("NoContent")))
            {
                this.datePostedLabel.Text = endDate;
            }
            else
            {
                this.datePostedLabel.Hidden = true;
            }

            if (Constants.JobDetailSiteName.Equals("adecco.fr"))
            {
                this.datePostedLabel.Frame    = new CGRect(273, 60, 85, 20);
                this.CategoryLabel.Hidden     = true;
                this.CategoryImageView.Hidden = true;
            }
        }
Ejemplo n.º 22
0
        void loadCharts()
        {
            overlayChart.RemoveAllData ();
            indicatorsChart.RemoveAllData ();

            TKChartNumericAxis yAxis = new TKChartNumericAxis ();
            yAxis.Range = new TKRange (new NSNumber (250), new NSNumber (750));
            yAxis.Style.LabelStyle.TextAlignment = TKChartAxisLabelAlignment.Right | TKChartAxisLabelAlignment.Bottom;
            yAxis.Style.LabelStyle.FirstLabelTextAlignment = TKChartAxisLabelAlignment.Right | TKChartAxisLabelAlignment.Top;
            yAxis.AllowZoom = true;
            yAxis.AllowPan = true;
            series.YAxis = yAxis;

            NSDateFormatter formatter = new NSDateFormatter ();
            formatter.DateFormat = "MM/dd/yyyy";

            NSDate minDate = formatter.Parse ("01/01/2011");
            NSDate maxDate = formatter.Parse ("01/01/2013");
            TKChartDateTimeAxis xAxis = new TKChartDateTimeAxis ();
            xAxis.Range = new TKRange (minDate, maxDate);
            xAxis.MinorTickIntervalUnit = TKChartDateTimeAxisIntervalUnit.Days;
            xAxis.MajorTickIntervalUnit = TKChartDateTimeAxisIntervalUnit.Years;
            xAxis.MajorTickInterval = 1;
            xAxis.Style.MajorTickStyle.TicksHidden = false;
            xAxis.Style.MajorTickStyle.TicksOffset = -3;
            xAxis.Style.MajorTickStyle.TicksWidth = 1.5f;
            xAxis.Style.MajorTickStyle.MaxTickClippingMode = TKChartAxisClippingMode.Visible;
            xAxis.Style.MajorTickStyle.TicksFill = new TKSolidFill (UIColor.FromRGB(203/255.0f, 203/255.0f, 203/255.0f));
            xAxis.AllowZoom = true;
            xAxis.AllowPan = true;
            series.XAxis = xAxis;

            OptionInfo info = Trendlines [SelectedTrendLine];
            info.Handler (info, EventArgs.Empty);

            info = Indicators [SelectedIndicator];
            info.Handler (info, EventArgs.Empty);
        }
Ejemplo n.º 23
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            nfloat WidthView = 0;

            nfloat XLabelDia           = 0;
            nfloat XLabelDiaNumero     = 0;
            nfloat XLabekNivel         = 0;
            nfloat XLabelNombreSala    = 0;
            nfloat XLabelHoraInicioFin = 0;
            nfloat XVistaDianNumero    = 0;

            /* for (int indice = 0; indice < this.Reservaciones.Count; indice++)
             * {
             *   WidthView = WidthView + this.vwVistaInfoReservacion.Frame.Width;
             * }*/

            this.btnAtras.Hidden     = true;
            this.btnAtras.Enabled    = false;
            this.btnAdelante.Hidden  = true;
            this.btnAdelante.Enabled = false;


            CGRect newFrame = new CGRect(this.vwInfoConfirmacion.Frame.X, this.vwInfoConfirmacion.Frame.Y, WidthView, this.vwInfoConfirmacion.Frame.Height);

            this.vwInfoConfirmacion.Frame = newFrame;

            var PrimeraReservacion = Reservaciones;

            dateFormat.DateFormat = "yyyy-MM-dd";
            NSDate newFormatDate = dateFormat.Parse(PrimeraReservacion.Sala_Fecha);

            this.lblDia.Text   = this.FormatoDiaSeleccionado(newFormatDate);
            this.lblNivel.Text = "NIVEL " + PrimeraReservacion.Sala_Nivel;

            dateFormat.DateFormat = "dd";
            var DiaSeleccionado = dateFormat.ToString(newFormatDate);

            this.lblDiaNumero.Text     = DiaSeleccionado;
            this.lblNombreSala.Text    = "SALA " + PrimeraReservacion.Sala_Descripcion;
            this.lblHoraInicioFin.Text = PrimeraReservacion.Sala_Hora_Inicio + ":00" + " - " + PrimeraReservacion.Sala_Hora_Fin + ":00";


            /*foreach (SalaJuntasReservacionModel Reservacion in Reservaciones)
             * {
             *  XLabelDia = XLabelDia + this.lblDia.Frame.Width;
             *  UILabel LabelDia = new UILabel();
             *  LabelDia.Frame = new CGRect(XLabelDia, this.lblDia.Frame.Y, this.lblDia.Frame.Width, this.lblDia.Frame.Height);
             *  dateFormat.DateFormat = "dd/MM/yyyy";
             *  newFormatDate = dateFormat.Parse(Reservacion.Sala_Fecha);
             *  LabelDia.Text = this.FormatoDiaSeleccionado(newFormatDate);
             *  LabelDia.Font = lblDia.Font;
             *  LabelDia.TextAlignment = UITextAlignment.Center;
             *
             *  XLabekNivel = XLabekNivel + this.lblNivel.Frame.Width;
             *  UILabel LabelNivel = new UILabel();
             *  LabelNivel.Frame = new CGRect(XLabekNivel, this.lblNivel.Frame.Y, this.lblNivel.Frame.Width, this.lblNivel.Frame.Height);
             *  LabelNivel.Text = "NIVEL " + Reservacion.Sala_Nivel;
             *  LabelNivel.Font = lblNivel.Font;
             *  LabelNivel.TextAlignment = UITextAlignment.Center;
             *  LabelNivel.TextColor = lblNivel.TextColor;
             *
             *  XLabelNombreSala = XLabelNombreSala + this.lblNombreSala.Frame.Width;
             *  UILabel LabelNombreSala = new UILabel();
             *  LabelNombreSala.Frame = new CGRect(XLabelNombreSala, this.lblNombreSala.Frame.Y, this.lblNombreSala.Frame.Width, this.lblNombreSala.Frame.Height);
             *  LabelNombreSala.Text = "SALA " + Reservacion.Sala_Descripcion;
             *  LabelNombreSala.Font = lblNombreSala.Font;
             *  LabelNombreSala.TextAlignment = UITextAlignment.Center;
             *
             *  XLabelHoraInicioFin = XLabelHoraInicioFin + this.lblHoraInicioFin.Frame.Width;
             *  UILabel LabelHoraInicoFin = new UILabel();
             *  LabelHoraInicoFin.Frame = new CGRect(XLabelHoraInicioFin, this.lblHoraInicioFin.Frame.Y, this.lblHoraInicioFin.Frame.Width, this.lblHoraInicioFin.Frame.Height);
             *  LabelHoraInicoFin.Text = Reservacion.Sala_Hora_Inicio + ":00" + " - " + Reservacion.Sala_Hora_Fin+ ":00";
             *  LabelHoraInicoFin.Font = lblHoraInicioFin.Font;
             *  LabelHoraInicoFin.TextAlignment = UITextAlignment.Center;
             *  LabelHoraInicoFin.TextColor = lblHoraInicioFin.TextColor;
             *
             *  XVistaDianNumero = XVistaDianNumero + this.vwDiaNumero.Frame.Width;
             *  UIView ViewVistaDiaNumero = new UIView();
             *  ViewVistaDiaNumero.Frame = new CGRect(XVistaDianNumero, this.vwDiaNumero.Frame.Y, this.vwDiaNumero.Frame.Width, this.vwDiaNumero.Frame.Height);
             *
             *  XLabelDiaNumero = XLabelDiaNumero + this.lblDiaNumero.Frame.Width;
             *  UILabel LabelDiaNumero = new UILabel(); ;
             *  LabelDiaNumero.Frame = this.lblDiaNumero.Frame;//new CGRect(this.lblDiaNumero.Frame.X, this.lblDiaNumero.Frame.Y, this.lblDiaNumero.Frame.Width, this.lblDiaNumero.Frame.Height);
             *  dateFormat.DateFormat = "dd";
             *  DiaSeleccionado = dateFormat.ToString(newFormatDate);
             *  LabelDiaNumero.Text = DiaSeleccionado;
             *  LabelDiaNumero.Font = lblDiaNumero.Font;
             *  LabelDiaNumero.TextAlignment = UITextAlignment.Center;
             *  LabelDiaNumero.TextColor = lblDiaNumero.TextColor;
             *
             *  ViewVistaDiaNumero.Add(LabelDiaNumero);
             *  ViewVistaDiaNumero.BackgroundColor = vwDiaNumero.BackgroundColor;
             *  ViewVistaDiaNumero.Layer.MasksToBounds = true;
             *  ViewVistaDiaNumero.Layer.CornerRadius = 5f;
             *
             *  this.vwInfoConfirmacion.Add(LabelDia);
             *  this.vwInfoConfirmacion.Add(ViewVistaDiaNumero);
             *  this.vwInfoConfirmacion.Add(LabelNivel);
             *  this.vwInfoConfirmacion.Add(LabelNombreSala);
             *  this.vwInfoConfirmacion.Add(LabelHoraInicoFin);
             * }*/

            this.svwInfoConfirmacion.ContentSize = vwInfoConfirmacion.Frame.Size;
        }
Ejemplo n.º 24
0
        /*
         * This is the main delegate method Anyline uses to report its results
         */
        void IAnylineOCRModuleDelegate.DidFindResult(AnylineOCRModuleView anylineOCRModuleView, ALOCRResult result)
        {
            StopAnyline();
            if (_drivingLicenseResultView != null)
            {
                View.BringSubviewToFront(_drivingLicenseResultView);
            }

            string[] comps = result.Result.ToString().Split('|');

            string name        = comps[0];
            string birthdateID = comps[1];

            string[] nameComps = name.Split(' ');

            switch (nameComps.Length)
            {
            case 0:
                break;

            case 1:
                _drivingLicenseResultView.Surname.Text    = nameComps[0];
                _drivingLicenseResultView.Surname2.Text   = "";
                _drivingLicenseResultView.GivenNames.Text = "";
                break;

            case 2:
                _drivingLicenseResultView.Surname.Text    = nameComps[0];
                _drivingLicenseResultView.Surname2.Text   = "";
                _drivingLicenseResultView.GivenNames.Text = nameComps[1];
                break;

            case 3:
                _drivingLicenseResultView.Surname.Text    = nameComps[0];
                _drivingLicenseResultView.Surname2.Text   = nameComps[1];
                _drivingLicenseResultView.GivenNames.Text = nameComps[2];
                break;

            default:
                break;
            }

            string[] birthdateIDComps = birthdateID.Split(' ');

            string birthday = birthdateIDComps[0];

            NSDateFormatter formatter = new NSDateFormatter();

            formatter.DateFormat = @"ddMMyyyy";

            NSDate date = formatter.Parse(birthday);

            if (date == null)
            {
                formatter.DateFormat = @"yyyyMMdd";
                date = formatter.Parse(birthday);
            }

            formatter.DateFormat = @"yyyy-MM-dd";
            _drivingLicenseResultView.Birthdate.Text = formatter.StringFor(date);
            _drivingLicenseResultView.IDNumber.Text  = birthdateIDComps[1];

            // Present the information to the user
            _drivingLicenseResultView?.AnimateFadeIn(View);
        }
Ejemplo n.º 25
0
 NSDate MinimumDateForCalendar(FSCalendar calendar)
 {
     return(DateFormatter.Parse("2016-07-08"));
 }
Ejemplo n.º 26
0
		void loadCharts()
		{
			TKChartNumericAxis yAxis = new TKChartNumericAxis ();
			yAxis.Range = new TKRange (new NSNumber (250), new NSNumber (750));
			yAxis.Style.LabelStyle.TextAlignment = TKChartAxisLabelAlignment.Right | TKChartAxisLabelAlignment.Bottom;
			yAxis.Style.LabelStyle.FirstLabelTextAlignment = TKChartAxisLabelAlignment.Right | TKChartAxisLabelAlignment.Top;
			yAxis.AllowZoom = true;
			yAxis.AllowPan = true;
			series.YAxis = yAxis;

			NSDateFormatter formatter = new NSDateFormatter ();
			formatter.DateFormat = "MM/dd/yyyy";

			NSDate minDate = formatter.Parse ("01/01/2011");
			NSDate maxDate = formatter.Parse ("01/01/2013");
			TKChartDateTimeAxis xAxis = new TKChartDateTimeAxis ();
			xAxis.Range = new TKRange (minDate, maxDate);
			xAxis.MinorTickIntervalUnit = TKChartDateTimeAxisIntervalUnit.Days;
			xAxis.MajorTickIntervalUnit = TKChartDateTimeAxisIntervalUnit.Years;
			xAxis.MajorTickInterval = 1;
			xAxis.Style.MajorTickStyle.TicksHidden = false;
			xAxis.Style.MajorTickStyle.TicksOffset = -3;
			xAxis.Style.MajorTickStyle.TicksWidth = 1.5f;
			xAxis.Style.MajorTickStyle.MaxTickClippingMode = TKChartAxisClippingMode.Visible;
			xAxis.Style.MajorTickStyle.TicksFill = new TKSolidFill (UIColor.FromRGB(203/255.0f, 203/255.0f, 203/255.0f));
			xAxis.AllowZoom = true;
			xAxis.AllowPan = true;
			series.XAxis = xAxis;

			AddTrendline (new TKChartSimpleMovingAverageIndicator (this.series));
			AddIndicator (new TKChartPercentageVolumeOscillator (this.series));
		}