Example #1
0
        // This method is invoked when the application has loaded its UI and its ready to run
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            // If you have defined a view, add it here:
            // window.AddSubview (navigationController.View);

            var device = new Device();

            Console.WriteLine("Device Name: {0}", device.Name);
            Console.WriteLine("Device Platform: {0}", device.Platform);
            Console.WriteLine("Device UUID: {0}", device.UUID);
            Console.WriteLine("Device Version: {0}", device.Version);
            Console.WriteLine("MonoMobile Version: {0}", device.MonoMobileVersion);


            var notification = new Notification();

            alertButton       = UIButton.FromType(UIButtonType.RoundedRect);
            alertButton.Frame = new System.Drawing.RectangleF(40f, 20f, 200f, 40f);
            alertButton.SetTitle("Alert button", UIControlState.Normal);
            alertButton.TouchUpInside += (s, e) => {
                notification.Alert("My Message", () => {
                    Console.WriteLine("Dismissed");
                }, "Title", "OK");
            };
            window.AddSubview(alertButton);

            confirmButton       = UIButton.FromType(UIButtonType.RoundedRect);
            confirmButton.Frame = new System.Drawing.RectangleF(40f, 60f, 200f, 40f);
            confirmButton.SetTitle("Confirm button", UIControlState.Normal);
            confirmButton.TouchUpInside += (s, e) => {
                notification.Confirm("My Message", (i) => {
                    Console.WriteLine("Button {0} pressed", i);
                }, "Alert!", "One, Two, Cancelled");
            };
            window.AddSubview(confirmButton);

            window.MakeKeyAndVisible();

            return(true);
        }
        public override void Init()
        {
            customExchanges.Add(new CustomExchange(ExchangeName_1, ExchangeEnable_1, ExchangeTimeInterval_1, TimeZoneInfo_1));
            customExchanges.Add(new CustomExchange(ExchangeName_2, ExchangeEnable_2, ExchangeTimeInterval_2, TimeZoneInfo_2));
            customExchanges.Add(new CustomExchange(ExchangeName_3, ExchangeEnable_3, ExchangeTimeInterval_3, TimeZoneInfo_3));
            customExchanges.Add(new CustomExchange(ExchangeName_4, ExchangeEnable_4, ExchangeTimeInterval_4, TimeZoneInfo_4));
            customExchanges.Add(new CustomExchange(ExchangeName_5, ExchangeEnable_5, ExchangeTimeInterval_5, TimeZoneInfo_5));
            customExchanges.Add(new CustomExchange(ExchangeName_6, ExchangeEnable_6, ExchangeTimeInterval_6, TimeZoneInfo_6));
            foreach (var item in settings.defaultExchanges)
            {
                item.Settings = settings;
            }

            totalMinutesInBar = getTotalMinutes();

            if ((HistoryDataSeries.HistoricalRequest as TimeHistoricalRequest).Period == Period.Second)
            {
                Notification.Alert("This timeframe is not valid");

                isDrawable = false;
            }

            var index = 0;

            settings.defaultExchanges.ForEach(x => {
                var _customExchange = customExchanges[index];
                if (_customExchange.IsEnable)
                {
                    x.Name      = _customExchange.Name;
                    x.BeginTime = _customExchange.TimeInterval.From;
                    x.EndTime   = _customExchange.TimeInterval.To;
                    x.Tzi       = _customExchange.TimeZoneInfo;
                    x.IsEnable  = _customExchange.IsEnable;
                }
                index++;
            });
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var notification = new Notification();

            alertButton       = UIButton.FromType(UIButtonType.RoundedRect);
            alertButton.Frame = new System.Drawing.RectangleF(40f, 20f, 200f, 40f);
            alertButton.SetTitle("Alert button", UIControlState.Normal);
            alertButton.TouchUpInside += (s, e) => {
                notification.Alert("My Message", () => {
                    Console.WriteLine("Dismissed");
                }, "Title", "OK");
            };
            this.View.AddSubview(alertButton);

            confirmButton       = UIButton.FromType(UIButtonType.RoundedRect);
            confirmButton.Frame = new System.Drawing.RectangleF(40f, 60f, 200f, 40f);
            confirmButton.SetTitle("Confirm button", UIControlState.Normal);
            confirmButton.TouchUpInside += (s, e) => {
                notification.Confirm("My Message", (i) => {
                    Console.WriteLine("Button {0} pressed", i);
                }, "Alert!", "One, Two, Cancelled");
            };
            this.View.AddSubview(confirmButton);

            beepButton       = UIButton.FromType(UIButtonType.RoundedRect);
            beepButton.Frame = new System.Drawing.RectangleF(40f, 100f, 200f, 40f);
            beepButton.SetTitle("Beep!", UIControlState.Normal);
            beepButton.TouchUpInside += (s, e) => {
                // Beep overload just calls beep anyway due to iPhone limitation.
                // Make sure there's a beep.wav set as content in the root of the app.
                notification.Beep();
            };
            this.View.AddSubview(beepButton);


            vibrateButton       = UIButton.FromType(UIButtonType.RoundedRect);
            vibrateButton.Frame = new System.Drawing.RectangleF(40f, 140f, 200f, 40f);
            vibrateButton.SetTitle("Vibrate!", UIControlState.Normal);
            vibrateButton.TouchUpInside += (s, e) => {
                // Vibrate overload just calls vibrate anyway due to iPhone limitation.
                notification.Vibrate();
            };
            this.View.AddSubview(vibrateButton);

            var camera = new Camera(this);

            cameraButton       = UIButton.FromType(UIButtonType.RoundedRect);
            cameraButton.Frame = new System.Drawing.RectangleF(40f, 180f, 200f, 40f);
            cameraButton.SetTitle("Get Picture!", UIControlState.Normal);
            cameraButton.TouchUpInside += (s, e) => {
                // Vibrate overload just calls vibrate anyway due to iPhone limitation.
                camera.GetPicture(new Camera.CameraOptions()
                {
                    SourceType = UIImagePickerControllerSourceType.SavedPhotosAlbum
                },
                                  (p) => { Console.WriteLine("Got picture as {0}", p); },
                                  () => { Console.WriteLine("Cancelled"); }
                                  );
            };
            this.View.AddSubview(cameraButton);
        }
Example #4
0
        public override void Update(TickStatus args)
        {
            if (args != TickStatus.IsQuote)
            {
                if (oneAlert == true)
                {
                    return;
                }

                if (fractalDimension % 2 == 0 || fractalDimension < 3)
                {
                    oneAlert = true;
                    Notification.Alert("Fractal Dimension must be an odd number, greater than or equal to three");
                }

                if (!(HistoryDataSeries.HistoricalRequest is TimeHistoricalRequest) && !(HistoryDataSeries.HistoricalRequest is TickHistoricalRequest))
                {
                    oneAlert = true;
                    Notification.Alert("Fractals can be built only on the type of aggregation Tick and Time");
                }

                bool isHighest = true;
                bool isLowest  = true;

                int minutesInCurrentPeriod = (HistoryDataSeries.HistoricalRequest as TimeHistoricalRequest).Value;

                int dim = fractalDimension;

                int minutesInPeriod = 0;

                if (agrType == AggregationType.Custom)
                {
                    switch (periodType)
                    {
                    case Period.Second:
                        minutesInPeriod = 1;
                        break;

                    case Period.Minute:
                        minutesInPeriod = (int)TimeSpan.FromMinutes(1).TotalMinutes;
                        break;

                    case Period.Hour:
                        minutesInPeriod = (int)TimeSpan.FromHours(1).TotalMinutes;
                        break;

                    case Period.Day:
                        minutesInPeriod = (int)TimeSpan.FromDays(1).TotalMinutes;
                        break;

                    case Period.Week:
                        minutesInPeriod = (int)TimeSpan.FromDays(7).TotalMinutes;
                        break;

                    case Period.Month:
                        minutesInPeriod = (int)TimeSpan.FromDays(30).TotalMinutes;
                        break;

                    case Period.Year:
                        minutesInPeriod = (int)TimeSpan.FromDays(365).TotalMinutes;
                        break;

                    default:
                        minutesInPeriod = (int)TimeSpan.FromHours(1).TotalMinutes;
                        break;
                    }

                    int minutesInMajorPeriod = minutesInPeriod * periodValue;

                    if (!oneAlert && minutesInCurrentPeriod > minutesInMajorPeriod)
                    {
                        oneAlert = true;

                        Notification.Alert("Please check custom period");
                    }

                    dim = fractalDimension * (minutesInMajorPeriod / minutesInCurrentPeriod);
                }

                if (HistoryDataSeries.HistoricalRequest is TickHistoricalRequest) // Tick chart
                {
                    dim = periodValue * (-(HistoryDataSeries.HistoricalRequest as TimeHistoricalRequest).Value);
                }

                if (HistoryDataSeries.Count < dim + 2)
                {
                    return;
                }

                int position = (dim - 1) / 2;

                for (int i = dim; i >= 0; i--)
                {
                    if (position != i)
                    {
                        if (High(position + 1) <= High(i + 1))
                        {
                            isHighest = false;
                        }

                        if (Low(position + 1) >= Low(i + 1))
                        {
                            isLowest = false;
                        }
                    }
                }

                if (isHighest)
                {
                    Lines[0].SetValue(High(position + 1) + 5 * InstrumentsManager.Current.MinimalTickSize, position + 1);
                }

                if (isLowest)
                {
                    Lines[1].SetValue(Low(position + 1) - 5 * InstrumentsManager.Current.MinimalTickSize, position + 1);
                }
            }
        }