Example #1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            JavaSystem.LoadLibrary("openxr_loader");
            JavaSystem.LoadLibrary("StereoKitC");

            // Set up a surface for StereoKit to draw on
            Window.TakeSurface(this);
            Window.SetFormat(Format.Unknown);
            surface = new View(this);
            SetContentView(surface);
            surface.RequestFocus();

            base.OnCreate(savedInstanceState);
            Xamarin.Essentials.Platform.Init(this, savedInstanceState);

            Run(Handle);
        }
Example #2
0
        private static void InternalTryLoadLibraryAtHint()
        {
            // Directory separator should not appear in library name
            // see: http://www.chilkatsoft.com/p/p_499.asp
            var hint = Path.Combine(InternalGetHintPath(), CPtrLibrary.LibraryPath) + ".dll";


            try
            {
                JavaSystem.load(hint);
            }
            catch (csharp.ThrowableException ex)
            {
                ((Throwable)(object)ex).printStackTrace();
                throw new System.InvalidOperationException("Failed to loadLibrary: " + CPtrLibrary.LibraryPath + " or " + hint);
            }
        }
Example #3
0
        public int go(int time)
        {
            //GET TIME IN SECONDS AND INITIALIZE INTENT

            Intent i = new Intent(this, typeof(MyReceiver));

            //PASS CONTEXT,YOUR PRIVATE REQUEST CODE,INTENT OBJECT AND FLAG
            PendingIntent pi = PendingIntent.GetBroadcast(this, 0, i, 0);

            //INITIALIZE ALARM MANAGER
            AlarmManager alarmManager = (AlarmManager)GetSystemService(AlarmService);

            //SET THE ALARM
            alarmManager.Set(AlarmType.RtcWakeup, JavaSystem.CurrentTimeMillis() + (time * 1000), pi);
            Toast.MakeText(this, "Alarm set In: " + time + "minutes", ToastLength.Short).Show();
            return(0);
        }
        public void OnDrawFrame(IGL10 unused)
        {
            GLES20.GlClear(GLES20.GlColorBufferBit);
            drawRectangle(yuvTextures[1], remoteVertices);
            drawRectangle(yuvTextures[0], localVertices);
            ++numFramesSinceLastLog;
            long now = JavaSystem.NanoTime();

            if (lastFPSLogTime == -1 || now - lastFPSLogTime > 1e9)
            {
                double fps = numFramesSinceLastLog / ((now - lastFPSLogTime) / 1e9);
                Log.Debug(TAG, "Rendered FPS: " + fps);
                lastFPSLogTime        = now;
                numFramesSinceLastLog = 1;
            }
            checkNoGLES2Error();
        }
Example #5
0
        public void Switchwifi(int number)
        {
            Intent i = new Intent(Application.Context, typeof(MyReceiver));

            PendingIntent pi = PendingIntent.GetBroadcast(Application.Context, 0, i, 0);

            try
            {
                AlarmManager alarmManager = (AlarmManager)Application.Context.GetSystemService(Activity.AlarmService);
                alarmManager.Set(AlarmType.RtcWakeup, JavaSystem.CurrentTimeMillis() + (number * 60000), pi);
            }
            catch (System.Exception ex)
            {
                Toast.MakeText(Application.Context, "error: " + ex + " ", ToastLength.Short).Show();
            }
            Toast.MakeText(Application.Context, "Wifi Disabled In: " + number + " minutes", ToastLength.Short).Show();
        }
        public Task <WebProxy> CreateProxyAsync(Uri destination)
        {
            // if a proxy is enabled set it up here
            string host = JavaSystem.GetProperty("http.proxyHost")?.TrimEnd('/');
            string port = JavaSystem.GetProperty("http.proxyPort");

            if (host == null)
            {
                return(Task.FromResult <WebProxy>(null));
            }

            //proxy auth
            //ICredentials credentials = new NetworkCredential("username", "password");
            //WebProxy proxy = new WebProxy(new Uri(host+':'+port), true, null, credentials);

            return(Task.FromResult(new WebProxy(host, Int32.Parse(port))));
        }
        /**
         * Updates the number of packets sent, and the total amount of data sent.
         * @param length The length of the packet
         * @param rtpts
         *            The RTP timestamp.
         * @throws IOException
         **/
        public void update(int length, long rtpts)
        {
            mPacketCount += 1;
            mOctetCount  += length;
            setLong(mPacketCount, 20, 24);
            setLong(mOctetCount, 24, 28);

            now    = SystemClock.ElapsedRealtime();
            delta += oldnow != 0 ? now - oldnow : 0;
            oldnow = now;
            if (interval > 0 && delta >= interval)
            {
                // We send a Sender Report
                send(JavaSystem.NanoTime(), rtpts);
                delta = 0;
            }
        }
Example #8
0
        private void AndroidEnvironmentOnUnhandledExceptionRaiser(object sender, RaiseThrowableEventArgs raiseThrowableEventArgs)
        {
            var intent = new Intent(activity, typeof(MainActivity));

            intent.PutExtra("crash", true);
            intent.AddFlags(ActivityFlags.ClearTop | ActivityFlags.ClearTask | ActivityFlags.NewTask);

            var pendingIntent = PendingIntent.GetActivity(MyApplication.instance, 0, intent, PendingIntentFlags.OneShot);

            var mgr = (AlarmManager)MyApplication.instance.GetSystemService(Context.AlarmService);

            mgr.Set(AlarmType.Rtc, DateTime.Now.Millisecond + 100, pendingIntent);

            activity.Finish();

            JavaSystem.Exit(2);
        }
Example #9
0
        public CustomEntryRenderer(Context context) : base(context)
        {
            mKeyboardView = (CustomKeyboardView)FindViewById(Resource.Id.keyboard_view);
            MainActivity deneme;

            MainActivity.mActivityRef.TryGetTarget(out deneme);
            mKeyboard = new Keyboard(deneme, Resource.Xml.keyboard2);

            mKeyboardView.Keyboard = mKeyboard;

            mKeyboardView.Key += (sender, e) => {
                long     eventTime = JavaSystem.CurrentTimeMillis();
                KeyEvent ev        = new KeyEvent(eventTime, eventTime, KeyEventActions.Down, e.PrimaryCode, 0, 0, 0, 0, KeyEventFlags.SoftKeyboard | KeyEventFlags.KeepTouchMode);

                this.DispatchKeyEvent(ev);
            };
        }
Example #10
0
        private void restartApp()
        {
            var intent = new Intent(activity, typeof(MainActivity));

            intent.PutExtra("crash", true);
            intent.AddFlags(ActivityFlags.ClearTop | ActivityFlags.ClearTask | ActivityFlags.NewTask);

            var pendingIntent = PendingIntent.GetActivity(MainActivity.instance, 0, intent, PendingIntentFlags.OneShot);

            var mgr = (AlarmManager)MainActivity.instance.GetSystemService(Context.AlarmService);

            mgr.Set(AlarmType.Rtc, DateTime.Now.Millisecond + 100, pendingIntent);

            activity.Finish();

            JavaSystem.Exit(2);
        }
Example #11
0
        void ScheduleHello()
        {
            if (!IsAlarmSet())
            {
                var alarm = (AlarmManager)GetSystemService(Context.AlarmService);
                var pendingServiceIntent = PendingIntent.GetService(this, 0, serviceIntent, PendingIntentFlags.CancelCurrent);

                // Start alarm around 8.30 and repeat every day
                Calendar calendar = Calendar.Instance;
                calendar.TimeInMillis = JavaSystem.CurrentTimeMillis();
                calendar.Set(CalendarField.HourOfDay, 8);
                calendar.Set(CalendarField.Minute, 30);

                //alarm.SetInexactRepeating(AlarmType.Rtc, calendar.TimeInMillis, AlarmManager.IntervalDay, pendingServiceIntent);
                alarm.SetInexactRepeating(AlarmType.Rtc, 0, 1000, pendingServiceIntent);
            }
        }
Example #12
0
        protected override void OnCreate(Bundle bundle)
        {
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;

            base.OnCreate(bundle);

            Forms.Init(this, bundle);

            // Initializing FFImageLoading
            CachedImageRenderer.Init(false);

            // Initializing User Dialogs
            UserDialogs.Init(this);

            // Initializing Xamarin Essentials
            Xamarin.Essentials.Platform.Init(this, bundle);

#if GORILLA
            LoadApplication(UXDivers.Gorilla.Droid.Player.CreateApplication(
                                this,
                                new UXDivers.Gorilla.Config("Good Gorilla")
                                .RegisterAssemblyFromType <InverseBooleanConverter>()
                                .RegisterAssemblyFromType <CachedImageRenderer>()));
#else
            //Loading dependent libindy
            JavaSystem.LoadLibrary("gnustl_shared");
            JavaSystem.LoadLibrary("indy");

            // Initializing QR Code Scanning support
            ZXing.Net.Mobile.Forms.Android.Platform.Init();

            //Marshmellow and above require permission requests to be made at runtime
            if ((int)Build.VERSION.SdkInt >= 23)
            {
                CheckAndRequestRequiredPermissions();
            }

            var builder = new ContainerBuilder();
            builder.RegisterModule(new PlatformModule());
            var container = builder.Build();

            LoadApplication(new App(container));
#endif
        }
Example #13
0
        public void SetAlarm(int ringAfterMinutes)
        {
            //Intent i = new Intent(Forms.Context, typeof(BroadcastReceiver));
            Intent i = new Intent(Forms.Context, typeof(MainActivity));

            i.PutExtra("alarm", "asdfadfadf");

            //PASS CONTEXT,YOUR PRIVATE REQUEST CODE,INTENT OBJECT AND FLAG
            //PendingIntent pi = PendingIntent.GetBroadcast(Forms.Context, 0, i, 0);
            PendingIntent pi = PendingIntent.GetActivity(Forms.Context, 0, i, 0);

            //INITIALIZE ALARM MANAGER
            Android.App.AlarmManager alarmManager = (Android.App.AlarmManager)Forms.Context.GetSystemService(Context.AlarmService);

            //SET THE ALARM
            alarmManager.Set(AlarmType.RtcWakeup, JavaSystem.CurrentTimeMillis() + (ringAfterMinutes * 60 * 1000), pi);
            Toast.MakeText(Forms.Context, "Alarm set in: " + ringAfterMinutes + " minutes", ToastLength.Short).Show();
        }
        /*
         * INITIALIZE AND START OUR ALARM
         */
        private void go()
        {
            //GET TIME IN SECONDS AND INITIALIZE INTENT
            int    time = Convert.ToInt32(timeTxt.Text);
            Intent i    = new Intent(this, typeof(MyReceiver));

            //PASS CONTEXT,YOUR PRIVATE REQUEST CODE,INTENT OBJECT AND FLAG
            PendingIntent pi = PendingIntent.GetBroadcast(this, 0, i, 0);

            //INITIALIZE ALARM MANAGER
            AlarmManager alarmManager = (AlarmManager)GetSystemService(AlarmService);


            //SET THE ALARM
            //alarmManager.Set(AlarmType.RtcWakeup, JavaSystem.CurrentTimeMillis()+(time*1000),pi);
            alarmManager.Set(AlarmType.RtcWakeup, JavaSystem.CurrentTimeMillis() + (myOffset * 1000), pi);
            Toast.MakeText(this, "Alarm set In: " + time + " seconds", ToastLength.Short).Show();
        }
Example #15
0
    public void waveformTouchEnd()
    {
        long elapsedMillisecond = JavaSystem.CurrentTimeMillis() - mWaveformTouchStartMsec;

        if (elapsedMillisecond < 300)
        {
            int seekMillisecond = mWaveformView.pixelsToMillisecs((int)(_touchStartX));
            _element.CurrentRangeIndex = seekMillisecond;
            seekableBackgroundView.LayoutParameters =
                new FrameLayout.LayoutParams((int)_touchStartX, _fragmentContainer.Height);
            if (seekableBackgroundView.Parent != null)
            {
                return;
            }

            _fragmentContainer.AddView(seekableBackgroundView);
        }
    }
Example #16
0
        public void PutAll(ListMap <K, V> map, int offset, int length)
        {
            if (offset + length > map.size)
            {
                throw new LSysException(
                          "offset + length must be <= size: " + offset + " + "
                          + length + " <= " + map.size);
            }
            int sizeNeeded = size + length - offset;

            if (sizeNeeded >= keys.Length)
            {
                Resize(MathUtils.Max(8, (int)(sizeNeeded * 1.75f)));
            }
            JavaSystem.Arraycopy(map.keys, offset, keys, size, length);
            JavaSystem.Arraycopy(map.values, offset, values, size, length);
            size += length;
        }
Example #17
0
        public void Put(K key, V value, int index)
        {
            if (size == keys.Length)
            {
                Resize(MathUtils.Max(8, (int)(size * 1.75f)));
            }
            int existingIndex = IndexOfKey(key);

            if (existingIndex != -1)
            {
                RemoveIndex(existingIndex);
            }
            JavaSystem.Arraycopy(keys, index, keys, index + 1, size - index);
            JavaSystem.Arraycopy(values, index, values, index + 1, size - index);
            keys[index]   = key;
            values[index] = value;
            size++;
        }
Example #18
0
        /** When start button is clicked. */
        protected void startButtonClicked(object sender, System.EventArgs args)
        {
            stopButton.Enabled      = !stopButton.Enabled;
            startButton.Enabled     = !startButton.Enabled;
            timestampButton.Enabled = !timestampButton.Enabled;

            // Configure recorder.
            recorder.SetAudioSource(AudioSource.Mic);
            recorder.SetOutputFormat(OutputFormat.ThreeGpp);
            recorder.SetAudioEncoder(AudioEncoder.AmrNb);
            recorder.SetOutputFile(path + "/audio" + audioNumber + ".3gpp");
            recorder.Prepare();
            recorder.Start();

            // Set initial timestamp and clean timestamps arraylist.
            startTimestamp = JavaSystem.CurrentTimeMillis();
            stamps.Clear();
        }
        // click event for for Set Alarm via seconds
        void StartBtn_Click(object sender, EventArgs e)
        {
            //GET TIME IN SECONDS AND INITIALIZE INTENT
            int    time = Convert.ToInt32(timeTxt.Text);
            Intent i    = new Intent(this, typeof(MyReceiver));

            //PASS CONTEXT,YOUR PRIVATE REQUEST CODE,INTENT OBJECT AND FLAG
            PendingIntent pi = PendingIntent.GetBroadcast(this, 0, i, 0);

            //INITIALIZE ALARM MANAGER
            AlarmManager alarmManager = (AlarmManager)GetSystemService(AlarmService);

            //SET THE ALARM
            alarmManager.Set(AlarmType.RtcWakeup, JavaSystem.CurrentTimeMillis() + (time * 1000), pi);
            Toast.MakeText(this, "Alarm set In: " + time + " seconds", ToastLength.Long).Show();

            ResetUserControls();
        }
Example #20
0
        public void RestartOrClose()
        {
            var packageManager = Application.Context.PackageManager;
            var intent         = packageManager.GetLaunchIntentForPackage(Application.Context.PackageName);
            var componentName  = intent.Component;
            var mainIntent     = Intent.MakeRestartActivityTask(componentName);

            mainIntent.AddFlags(ActivityFlags.ClearTop);

            var pendingIntent = PendingIntent.GetActivity(Application.Context, 0, mainIntent,
                                                          PendingIntentFlags.CancelCurrent);
            var mgr = (AlarmManager)Application.Context.GetSystemService(Context.AlarmService);

            mgr.Set(AlarmType.Rtc, JavaSystem.CurrentTimeMillis() + 1000, pendingIntent);

            Log.Debug("AndroidAppCloser", "Closing!");
            Runtime.GetRuntime().Exit(0);
        }
Example #21
0
        private void ComputeCurrentValue()
        {
            if (!(Math.Abs(mCurrentValue - mTargetValue) > 0.01f))
            {
                return;
            }

            if (-1 != mNeedleLastMoved)
            {
                float time      = (JavaSystem.CurrentTimeMillis() - mNeedleLastMoved) / 1000.0f;
                float direction = Math.Signum(mNeedleVelocity);
                if (Math.Abs(mNeedleVelocity) < 90.0f)
                {
                    mNeedleAcceleration = 5.0f * (mTargetValue - mCurrentValue);
                }
                else
                {
                    mNeedleAcceleration = 0.0f;
                }

                mNeedleAcceleration = 5.0f * (mTargetValue - mCurrentValue);
                mCurrentValue      += mNeedleVelocity * time;
                mNeedleVelocity    += mNeedleAcceleration * time;

                if ((mTargetValue - mCurrentValue) * direction < 0.01f * direction)
                {
                    mCurrentValue       = mTargetValue;
                    mNeedleVelocity     = 0.0f;
                    mNeedleAcceleration = 0.0f;
                    mNeedleLastMoved    = -1L;
                }
                else
                {
                    mNeedleLastMoved = JavaSystem.CurrentTimeMillis();
                }

                Invalidate();
            }
            else
            {
                mNeedleLastMoved = JavaSystem.CurrentTimeMillis();
                ComputeCurrentValue();
            }
        }
Example #22
0
        public void Update()
        {
                        #if ANDROID
            long currentMilli = JavaSystem.CurrentTimeMillis();
            if (millisecond <= currentMilli)
            {
                Delta += (((currentMilli - millisecond) / 1000f) - Delta) * .1f;
            }
            millisecond = currentMilli;
                        #elif NaCl || SILVERLIGHT
            long currentMilli = DateTime.Now.Millisecond;
            if (millisecond <= currentMilli)
            {
                Delta += (((currentMilli - millisecond) / 1000f) - Delta) * .1f;
            }
            millisecond = currentMilli;
                        #elif SILVERLIGHT || VITA
            long currentMilli = stopWatch.ElapsedMilliseconds;
            Delta += ((currentMilli / 1000f) - Delta) * .1f;

            stopWatch.Reset();
            stopWatch.Start();
                        #else
            Delta += ((stopWatch.ElapsedTicks / (float)(Stopwatch.Frequency)) - Delta) * .1f;
                        #if XBOX360
            stopWatch.Reset();
            stopWatch.Start();
                        #else
            stopWatch.Restart();
                        #endif
                        #endif

            Delta = (Delta > 1) ? 1 : Delta;
            Delta = (Delta < 0) ? 0 : Delta;

            ++fpsTic;
            seconds += Delta;
            if (seconds >= 1)
            {
                FPS     = fpsTic;
                fpsTic  = 0;
                seconds = 0;
            }
        }
Example #23
0
        public static byte[] DecodeBitmap(Bitmap image, int parting)
        {
            List <byte[]> data = DecodeBitmapToDataList(image, parting);
            int           len  = 0;

            foreach (byte[] srcArray in data)
            {
                len += srcArray.Length;
            }
            byte[] destArray = new byte[len];
            int    destLen   = 0;

            foreach (byte[] srcArray in data)
            {
                JavaSystem.Arraycopy(srcArray, 0, destArray, destLen, srcArray.Length);
                destLen += srcArray.Length;
            }
            return(destArray);
        }
Example #24
0
        public void OnSensorChanged(SensorEvent e)
        {
            var x = e.Values[0];
            var y = e.Values[1];
            var z = e.Values[2];

            var gX = x / SensorManager.GravityEarth;
            var gY = y / SensorManager.GravityEarth;
            var gZ = z / SensorManager.GravityEarth;


            // gForce will be close to 1 when there is no movement.
            var gForce = Java.Lang.Math.Sqrt(gX * gX + gY * gY + gZ * gZ);

            if (!(gForce > SHAKE_THRESHOLD_GRAVITY))
            {
                return;
            }

            var now = JavaSystem.CurrentTimeMillis();


            // Ignore shake events too close to each other (500ms)
            if (mShakeTimestamp + SHAKE_SLOP_TIME_MS > now)
            {
                return;
            }


            // Reset the shake count after 3 seconds of no shakes
            if (mShakeTimestamp + SHAKE_COUNT_RESET_TIME_MS < now)
            {
                mShakeCount = 0;
            }

            mShakeTimestamp = now;
            mShakeCount++;

            if (this.Shaked != null)
            {
                this.Shaked(this, mShakeCount, x, y, z);
            }
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            JavaSystem.LoadLibrary("gnustl_shared");
            JavaSystem.LoadLibrary("indy");

            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;

            base.OnCreate(savedInstanceState);
            global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
            LoadApplication(new App());

            if (Build.VERSION.SdkInt >= BuildVersionCodes.M)
            {
                RequestPermissions(new[] { Manifest.Permission.ReadExternalStorage }, 10);
                RequestPermissions(new[] { Manifest.Permission.WriteExternalStorage }, 10);
                RequestPermissions(new[] { Manifest.Permission.Internet }, 10);
            }
        }
Example #26
0
 public override string GetTextSync(string path)
 {
     System.Text.StringBuilder sbr = new System.Text.StringBuilder(1024);
     try
     {
         StreamReader reader = new StreamReader(OpenStream(path), JavaSystem.GetEncoding(LSystem.ENCODING));
         string       record = null;
         for (; (record = reader.ReadLine()) != null;)
         {
             sbr.Append(record);
         }
         reader.Close();
     }
     catch (System.Exception ex)
     {
         LSystem.E("file :" + path + " exception:" + ex.Message);
     }
     return(sbr.ToString());
 }
Example #27
0
        public void LocalNotification(string title, string body, int id, DateTime notifyTime, int frequencyHour)
        {
            //long repeateDay = 1000 * 60 * 60 * 24;
            long repeatInterval    = frequencyHour * 60 * 100;
            long repeateForMinute  = 60000; // In milliseconds
            long totalMilliSeconds = (long)(notifyTime.ToUniversalTime() - _jan1st1970).TotalMilliseconds;

            if (totalMilliSeconds < JavaSystem.CurrentTimeMillis())
            {
                totalMilliSeconds = totalMilliSeconds + repeatInterval;
            }

            var intent            = CreateIntent(id);
            var localNotification = new LocalNotification();

            localNotification.Title      = title;
            localNotification.Body       = body;
            localNotification.Id         = id;
            localNotification.NotifyTime = notifyTime;

            if (_notificationIconId != 0)
            {
                localNotification.IconId = _notificationIconId;
            }
            else
            {
                localNotification.IconId = Resource.Drawable.notification_bg;
            }

            var serializedNotification = SerializeNotification(localNotification);

            intent.PutExtra(ScheduledAlarmHandler.LocalNotificationKey, serializedNotification);

            Random generator = new Random();

            _randomNumber = generator.Next(100000, 999999).ToString("D6");

            var pendingIntent = PendingIntent.GetBroadcast(Application.Context, Convert.ToInt32(_randomNumber), intent, PendingIntentFlags.Immutable);
            var alarmManager  = GetAlarmManager();

            alarmManager.SetRepeating(AlarmType.RtcWakeup, totalMilliSeconds, repeateForMinute, pendingIntent);
        }
        protected override void OnCreate(Bundle bundle)
        {
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;

            base.OnCreate(bundle);

            AndroidEnvironment.UnhandledExceptionRaiser += delegate(object sender, RaiseThrowableEventArgs args) {
                typeof(System.Exception).GetField("stack_trace", BindingFlags.NonPublic | BindingFlags.Instance)
                .SetValue(args.Exception, null);
                throw args.Exception;
            };
            Forms.Init(this, bundle);

            App.ScreenHeight = (int)(Resources.DisplayMetrics.HeightPixels / Resources.DisplayMetrics.Density);
            App.ScreenWidth  = (int)(Resources.DisplayMetrics.WidthPixels / Resources.DisplayMetrics.Density);

            Acr.UserDialogs.UserDialogs.Init(this);
            // Initializing FFImageLoading
            CachedImageRenderer.Init(false);
            //Rg.Plugins.Popup.Popup.Init(this, bundle);
            // Initializing Xamarin Essentials
            Xamarin.Essentials.Platform.Init(this, bundle);

            // Initializing QR Code Scanning support
            ZXing.Net.Mobile.Forms.Android.Platform.Init();
            ZXing.Mobile.MobileBarcodeScanner.Initialize(Application);

            // Initializing User Dialogs
            // Android requires that we set content root.
            var host = App.BuildHost(typeof(PlatformModule).Assembly)
                       .UseContentRoot(System.Environment.GetFolderPath(
                                           System.Environment.SpecialFolder.Personal)).Build();

            //Loading dependent libindy
            JavaSystem.LoadLibrary("c++_shared");
            JavaSystem.LoadLibrary("indy");

            LoadApplication(host.Services.GetRequiredService <App>());

            CheckAndRequestRequiredPermissions();
        }
Example #29
0
        public static bool[] Slice(bool[] array, int begin, int end)
        {
            if (begin > end)
            {
                throw new LSysException("BoolArray begin > end");
            }
            if (begin < 0)
            {
                begin = array.Length + begin;
            }
            if (end < 0)
            {
                end = array.Length + end;
            }
            int elements = end - begin;

            bool[] ret = new bool[elements];
            JavaSystem.Arraycopy(array, begin, ret, 0, elements);
            return(ret);
        }
Example #30
0
        public bool RemoveIndex(int index)
        {
            if (index >= length)
            {
                throw new LSysException("index can't be >= length: " + index + " >= " + length);
            }
            bool[] items = this.items;
            bool   value = items[index];

            length--;
            if (ordered)
            {
                JavaSystem.Arraycopy(items, index + 1, items, index, length - index);
            }
            else
            {
                items[index] = items[length];
            }
            return(value);
        }