private void Setup(Android.Content.Context context)
 {
     AndroidContext = context;
     TextureLoader._context = context;
     RequestFocus();
     FocusableInTouchMode = true;
 }
 protected ResourceTextureSource(Context pContext, int pDrawableResourceID, int pWidth, int pHeight)
 {
     this.mContext = pContext;
     this.mDrawableResourceID = pDrawableResourceID;
     this.mWidth = pWidth;
     this.mHeight = pHeight;
 }
 AssetTextureSource(Context pContext, String pAssetPath, int pWidth, int pHeight)
 {
     this.mContext = pContext;
     this.mAssetPath = pAssetPath;
     this.mWidth = pWidth;
     this.mHeight = pHeight;
 }
        // ===========================================================
        // Constructors
        // ===========================================================

        public AssetTextureSource(Context pContext, String pAssetPath)
        {
            this.mContext = pContext;
            this.mAssetPath = pAssetPath;

            BitmapFactory.Options decodeOptions = new BitmapFactory.Options();
            decodeOptions.InJustDecodeBounds = true;

            //InputStream input = null;
            System.IO.Stream input = null;
            try
            {
                //input = pContext.getAssets().open(pAssetPath);
                input = pContext.Assets.Open(pAssetPath);
                BitmapFactory.DecodeStream(input, null, decodeOptions);
            }
            catch (IOException e)
            {
                Debug.E("Failed loading Bitmap in AssetTextureSource. AssetPath: " + pAssetPath, e);
            }
            finally
            {
                StreamUtils.CloseStream(input);
            }

            this.mWidth = decodeOptions.OutWidth;
            this.mHeight = decodeOptions.OutHeight;
        }
Beispiel #5
0
        public GLView1(Context context, IClientSettings settings)
            : base(context)
        {
            this.settings = settings;

            gl = new AndroidGL();
            nativeGraphicsContext = new GameViewContext(this);
            assetManager = context.Assets;
            KeepScreenOn = true;
        }
        // ===========================================================
        // Methods for/from SuperClass/Interfaces
        // ===========================================================

        // ===========================================================
        // Methods
        // ===========================================================

        public static Music CreateMusicFromFile(MusicManager pMusicManager, Context pContext, File pFile) /* throws IOException */ {
            MediaPlayer mediaPlayer = new MediaPlayer();

            mediaPlayer.SetDataSource(new FileInputStream(pFile).FD);
            mediaPlayer.Prepare();

            Music music = new Music(pMusicManager, mediaPlayer);
            pMusicManager.Add(music);

            return music;
        }
        public static Music CreateMusicFromAsset(MusicManager pMusicManager, Context pContext, String pAssetPath) /*throws IOException */ {
            MediaPlayer mediaPlayer = new MediaPlayer();

            //AssetFileDescriptor assetFileDescritor = pContext.getAssets().openFd(MusicFactory.sAssetBasePath + pAssetPath);
            AssetFileDescriptor assetFileDescritor = pContext.Assets.OpenFd(MusicFactory.sAssetBasePath + pAssetPath);
            mediaPlayer.SetDataSource(assetFileDescritor.FileDescriptor, assetFileDescritor.StartOffset, assetFileDescritor.Length);
            mediaPlayer.Prepare();

            Music music = new Music(pMusicManager, mediaPlayer);
            pMusicManager.Add(music);

            return music;
        }
        // ===========================================================
        // Constructors
        // ===========================================================

        public ResourceTextureSource(Context pContext, int pDrawableResourceID)
        {
            this.mContext = pContext;
            this.mDrawableResourceID = pDrawableResourceID;

            BitmapFactory.Options decodeOptions = new BitmapFactory.Options();
            decodeOptions.InJustDecodeBounds = true;
            //		decodeOptions.inScaled = false; // TODO Check how this behaves with drawable-""/nodpi/ldpi/mdpi/hdpi folders

            BitmapFactory.DecodeResource(pContext.Resources, pDrawableResourceID, decodeOptions);

            this.mWidth = decodeOptions.OutWidth;
            this.mHeight = decodeOptions.OutHeight;
        }
 public TypefaceSpan(Android.Content.Context context, Typeface typeface, double textSize)
 {
     _context  = context;
     _typeface = typeface;
     _textSize = textSize;
 }
Beispiel #10
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @TargetApi(android.os.BuildVersionCodes.LOLLIPOP) public BottomNavigationBar(Android.Content.Context context, Android.Util.IAttributeSet attrs, int defStyleAttr, int defStyleRes)
        public BottomNavigationBar(Context context, IAttributeSet attrs, int defStyleAttr, int defStyleRes) : base(context, attrs, defStyleAttr, defStyleRes)
        {
            parseAttrs(context, attrs);
            init();
        }
Beispiel #11
0
        ///////////////////////////////////////////////////////////////////////////
        // View Default Constructors and Methods
        ///////////////////////////////////////////////////////////////////////////

        public BottomNavigationBar(Context context) : this(context, null)
        {
        }
Beispiel #12
0
        public override Android.Views.View GetSampleContent(Android.Content.Context context)
        {
            handler = new Handler();
            LinearLayout layout   = new LinearLayout(context);
            TextView     textView = new TextView(context);

            textView.TextSize = 16;
            textView.SetPadding(10, 20, 0, 0);
            textView.SetHeight(90);

            textView.Text = "Primary Agricultural Activity of USA";
            layout.AddView(textView);
            textView.Gravity = Android.Views.GravityFlags.Top;

            layout.Orientation = Orientation.Vertical;
            maps         = new SfMaps(context);
            currentToast = new Toast(context);
            ShapeFileLayer layer = new ShapeFileLayer();

            layer.Uri            = "usa_state.shp";
            layer.ShapeSelected += (object sender, ShapeFileLayer.ShapeSelectedEventArgs e) => {
                JSONObject data = (JSONObject)e.P0;
                if (data != null)
                {
                    if (currentToast != null)
                    {
                        currentToast.Cancel();
                    }
                    currentToast = Toast.MakeText(context, data.Get("Name") + "\n" + data.Get("Type"), ToastLength.Short);
                    currentToast.Show();
                }
            };
            layer.EnableSelection   = true;
            layer.ShapeIdTableField = "STATE_NAME";
            layer.ShapeIdPath       = "Name";
            layer.DataSource        = GetDataSource();
            layer.ShapeSettings.ShapeColorValuePath = "Type";
            layer.ShapeSettings.ShapeFill           = Color.ParseColor("#A9D9F7");
            SetColorMapping(layer.ShapeSettings);

            layer.LegendSetting = new LegendSetting()
            {
                ShowLegend = true
            };

            maps.Layers.Add(layer);

            SfBusyIndicator sfBusyIndicator = new SfBusyIndicator(context);

            sfBusyIndicator.IsBusy        = true;
            sfBusyIndicator.AnimationType = AnimationTypes.SlicedCircle;
            sfBusyIndicator.ViewBoxWidth  = 50;
            sfBusyIndicator.ViewBoxHeight = 50;
            sfBusyIndicator.TextColor     = Color.ParseColor("#779772");

            layout.AddView(sfBusyIndicator);
            Java.Lang.Runnable run = new Java.Lang.Runnable(() =>
            {
                layout.RemoveView(sfBusyIndicator);
                layout.AddView(maps);
            });
            handler.PostDelayed(run, 100);

            return(layout);
        }
Beispiel #13
0
 public AuthenticateUIType GetUI(UIContext context)
 {
     this.context = context;
     return(GetPlatformUI(context));
 }
Beispiel #14
0
		/// <summary>
		/// Deletes a previously saved account associated with this service.
		/// </summary>
		public virtual void DeleteAccount (Account account, AppContext context)
		{
			AccountStore.Create (context).Delete (account, ServiceId);
		}
        public SegementViewViewModel(Android.Content.Context con)
        {
            ClothTypeCollection.Add("Formals");
            ClothTypeCollection.Add("Casuals");
            ClothTypeCollection.Add("Trendy");
            Typeface tf = Typeface.CreateFromAsset(con.Assets, "Segmented.ttf");
            Typeface colorfontFamily = Typeface.CreateFromAsset(con.Assets, "SegmentIcon.ttf");

            SizeCollection = new ObservableCollection <SfSegmentItem>
            {
                new SfSegmentItem()
                {
                    IconFont = "A", Text = "XS", FontIconTypeface = tf, FontColor = Color.ParseColor("#3F3F3F")
                },
                new SfSegmentItem()
                {
                    IconFont = "A", Text = "S", FontColor = Color.ParseColor("#3F3F3F")
                },
                new SfSegmentItem()
                {
                    IconFont = "A", Text = "M", FontColor = Color.ParseColor("#3F3F3F")
                },
                new SfSegmentItem()
                {
                    IconFont = "A", Text = "L", FontColor = Color.ParseColor("#3F3F3F")
                },
                new SfSegmentItem()
                {
                    IconFont = "A", Text = "XL", FontColor = Color.ParseColor("#3F3F3F")
                },
            };

            EntertainCollection = new ObservableCollection <SfSegmentItem>
            {
                new SfSegmentItem()
                {
                    IconFont = "A", FontIconFontColor = Color.ParseColor("#233a7e"), FontIconTypeface = tf
                },
                new SfSegmentItem()
                {
                    IconFont = "A", FontIconFontColor = Color.ParseColor("#7e8188"), FontIconTypeface = tf
                },
                new SfSegmentItem()
                {
                    IconFont = "A", FontIconFontColor = Color.ParseColor("#292639"), FontIconTypeface = tf
                },
                new SfSegmentItem()
                {
                    IconFont = "A", FontIconFontColor = Color.ParseColor("#11756d"), FontIconTypeface = tf
                },
                new SfSegmentItem()
                {
                    IconFont = "A", FontIconFontColor = Color.ParseColor("#6e0022"), FontIconTypeface = tf
                },
            };

            PrimaryColors = new ObservableCollection <SfSegmentItem>
            {
                new SfSegmentItem()
                {
                    IconFont = "7", FontIconFontColor = Color.ParseColor("#32318E"), Text = "Square", FontIconFontSize = 32, FontIconTypeface = colorfontFamily
                },
                new SfSegmentItem()
                {
                    IconFont = "7", FontIconFontColor = Color.ParseColor("#2F7DC0"), Text = "Square", FontIconFontSize = 32, FontIconTypeface = colorfontFamily
                },
                new SfSegmentItem()
                {
                    IconFont = "7", FontIconFontColor = Color.ParseColor("#953376"), Text = "Square", FontIconFontSize = 32, FontIconTypeface = colorfontFamily
                },
                new SfSegmentItem()
                {
                    IconFont = "7", FontIconFontColor = Color.ParseColor("#B33F3F"), Text = "Square", FontIconFontSize = 32, FontIconTypeface = colorfontFamily
                },
                new SfSegmentItem()
                {
                    IconFont = "7", FontIconFontColor = Color.ParseColor("#F1973F"), Text = "Square", FontIconFontSize = 32, FontIconTypeface = colorfontFamily
                },
                new SfSegmentItem()
                {
                    IconFont = "7", FontIconFontColor = Color.ParseColor("#C9D656"), Text = "Square", FontIconFontSize = 32, FontIconTypeface = colorfontFamily
                },
                new SfSegmentItem()
                {
                    IconFont = "7", FontIconFontColor = Color.ParseColor("#008D7F"), Text = "Square", FontIconFontSize = 32, FontIconTypeface = colorfontFamily
                },
            };
        }
 /// <summary>
 /// This is called when we receive a response code from Android Market for a
 /// RestoreTransactions request. </summary>
 /// <param name="context"> the context </param>
 /// <param name="request"> the RestoreTransactions request for which we received a
 ///     response code </param>
 /// <param name="responseCode"> a response code from Market to indicate the state
 ///     of the request </param>
 public static void responseCodeReceived(Context context, RestoreTransactions request, ResponseCode responseCode)
 {
     if (sPurchaseObserver != null)
     {
         sPurchaseObserver.onRestoreTransactionsResponse(request, responseCode);
     }
 }
 /// <summary>
 /// Notifies the application of purchase state changes. The application
 /// can offer an item for sale to the user via
 /// <seealso cref="BillingService#requestPurchase(String)"/>. The BillingService
 /// calls this method after it gets the response. Another way this method
 /// can be called is if the user bought something on another device running
 /// this same app. Then Android Market notifies the other devices that
 /// the user has purchased an item, in which case the BillingService will
 /// also call this method. Finally, this method can be called if the item
 /// was refunded. </summary>
 /// <param name="purchaseState"> the state of the purchase request (PURCHASED,
 ///     CANCELED, or REFUNDED) </param>
 /// <param name="productId"> a string identifying a product for sale </param>
 /// <param name="orderId"> a string identifying the order </param>
 /// <param name="purchaseTime"> the time the product was purchased, in milliseconds
 ///     since the epoch (Jan 1, 1970) </param>
 /// <param name="developerPayload"> the developer provided "payload" associated with
 ///     the order </param>
 //JAVA TO C# CONVERTER WARNING: 'final' parameters are not allowed in .NET:
 //ORIGINAL LINE: public static void purchaseResponse(final android.content.Context context, final InAppBilling.Consts.PurchaseState purchaseState, final String productId, final String orderId, final long purchaseTime, final String developerPayload)
 public static void purchaseResponse(Context context, PurchaseState purchaseState, string productId, string orderId, long purchaseTime, string developerPayload)
 {
     // Update the database with the purchase state. We shouldn't do that
     // from the main thread so we do the work in a background thread.
     // We don't update the UI here. We will update the UI after we update
     // the database because we need to read and update the current quantity
     // first.
     //JAVA TO C# CONVERTER TODO TASK: Anonymous inner classes are not converted to C# if the base type is not defined in the code being converted:
     //			new Thread(new Runnable()
     //		{
     //			public void run()
     //			{
     //				PurchaseDatabase db = new PurchaseDatabase(context);
     //				int quantity = db.updatePurchase(orderId, productId, purchaseState, purchaseTime, developerPayload);
     //				db.close();
     //
     //				// This needs to be synchronized because the UI thread can change the
     //				// value of sPurchaseObserver.
     //				synchronized(ResponseHandler.class)
     //				{
     //					if (sPurchaseObserver != null)
     //					{
     //						sPurchaseObserver.postPurchaseStateChange(purchaseState, productId, quantity, purchaseTime, developerPayload);
     //					}
     //				}
     //			}
     //		}).start();
 }
        public static Music createMusicFromResource(MusicManager pMusicManager, Context pContext, int pMusicResID) /* throws IOException */ {
            MediaPlayer mediaPlayer = MediaPlayer.Create(pContext, pMusicResID);
            mediaPlayer.Prepare();

            Music music = new Music(pMusicManager, mediaPlayer);
            pMusicManager.Add(music);

            return music;
        }
Beispiel #19
0
 public Launcher( Android.Content.Context context )
 {
     IsInitialized = false;
     this.context = context;
 }
 /**
  * Standard View constructor. In order to render something, you must call
  * {@link #setRenderer} to register a renderer.
  */
 public GLSurfaceView(Context context, AttributeSet attrs)
     : base(context, attrs)
 {
     this.Init();
 }
Beispiel #21
0
 public RoundedContentViewRenderer(Android.Content.Context context) : base(context)
 {
 }
Beispiel #22
0
 public CometView(AContext context) : base(context)
 {
 }
        // ===========================================================
        // Constructors
        // ===========================================================

        /**
         * Standard View constructor. In order to render something, you must call
         * {@link #setRenderer} to register a renderer.
         */
        public GLSurfaceView(Context context)
            : base(context)
        {
            this.Init();
        }
        protected override Android.Views.View GetCellCore(Cell item, Android.Views.View convertView, Android.Views.ViewGroup parent, Android.Content.Context context)
        {
            var cellCache = FastCellCache.Instance.GetCellCache(parent);
            var fastCell  = item as FastCell;

            _cellCore = convertView;
            _selected = false;

            if (_cellCore != null && cellCache.IsCached(_cellCore))
            {
                cellCache.RecycleCell(_cellCore, fastCell);
                _unselectedBackground = _cellCore.Background;
            }
            else
            {
                var newCell = (FastCell)Activator.CreateInstance(item.GetType());
                newCell.BindingContext = item.BindingContext;
                newCell.Parent         = item.Parent;

                if (!newCell.IsInitialized)
                {
                    newCell.PrepareCell();
                }
                _cellCore = base.GetCellCore(newCell, convertView, parent, context);
                cellCache.CacheCell(newCell, _cellCore);
                _unselectedBackground = _cellCore.Background;
            }


            return(_cellCore);
        }
        public override Android.Views.View GetSampleContent(Android.Content.Context context)
        {
            GridImageColumn customerImageColumn = new GridImageColumn();

            customerImageColumn.MappingName = "CustomerImage";
            customerImageColumn.HeaderText  = "Image";

            GridSwitchColumn isOpenColumn = new GridSwitchColumn();

            isOpenColumn.MappingName = "IsOpen";
            isOpenColumn.HeaderText  = "Is Open";

            GridTextColumn customerIdColumn = new GridTextColumn();

            customerIdColumn.MappingName   = "CustomerID";
            customerIdColumn.HeaderText    = "Customer ID";
            customerIdColumn.TextAlignment = GravityFlags.Center;

            GridTextColumn branchNoColumn = new GridTextColumn();

            branchNoColumn.MappingName   = "BranchNo";
            branchNoColumn.HeaderText    = "Branch No";
            branchNoColumn.TextAlignment = GravityFlags.Center;

            GridTextColumn currentColumn = new GridTextColumn();

            currentColumn.MappingName   = "Current";
            currentColumn.Format        = "C";
            currentColumn.CultureInfo   = new CultureInfo("en-US");
            currentColumn.TextAlignment = GravityFlags.Center;

            GridTextColumn customerNameColumn = new GridTextColumn();

            customerNameColumn.MappingName   = "CustomerName";
            customerNameColumn.HeaderText    = "Customer Name";
            customerNameColumn.TextAlignment = GravityFlags.CenterVertical;

            GridTextColumn savingsColumn = new GridTextColumn();

            savingsColumn.MappingName   = "Savings";
            savingsColumn.Format        = "C";
            savingsColumn.CultureInfo   = new CultureInfo("en-US");
            savingsColumn.TextAlignment = GravityFlags.Center;

            sfGrid = new SfDataGrid(context);
            sfGrid.AutoGenerateColumns    = false;
            sfGrid.SelectionMode          = SelectionMode.Single;
            sfGrid.RowHeight              = 70;
            sfGrid.VerticalOverScrollMode = VerticalOverScrollMode.None;
            sfGrid.Columns.Add(customerImageColumn);
            sfGrid.Columns.Add(customerIdColumn);
            sfGrid.Columns.Add(branchNoColumn);
            sfGrid.Columns.Add(currentColumn);
            sfGrid.Columns.Add(customerNameColumn);
            sfGrid.Columns.Add(savingsColumn);
            sfGrid.Columns.Add(isOpenColumn);
            viewmodel          = new FormattingViewModel();
            sfGrid.ItemsSource = viewmodel.BankInfo;

            return(sfGrid);
        }
Beispiel #26
0
 protected abstract AuthenticateUIType GetPlatformUI(UIContext context);
Beispiel #27
0
        public bool Initialize(Android.Content.Context context)
                #endif
        {
                        #if !ANDROID
            m_ID = id;
                        #endif
#if MONO
            bool success = false;
#else
            bool success = ReadFromSharedMemory();
#endif
                        #if !ANDROID
            if (!success && !String.IsNullOrEmpty(directory))
            {
                success = ReadFromFile(directory);
            }
            if (!success)
            {
                InitDefaults();
            }
                        #else
            InitDefaults();
            success = Read(context);
                        #endif
            bool hasIP = !String.IsNullOrEmpty(IPAddress);
            if (hasIP)
            {
                try
                {
                    System.Net.IPAddress addr = System.Net.IPAddress.Parse(IPAddress);
                }
                catch (Exception)
                {
                    hasIP = false;
                }
            }
            if (!hasIP)
            {
                var addresses = System.Net.Dns.GetHostAddresses(String.Empty);
                if (addresses.Length > 0)
                {
                    IPAddress = addresses[0].ToString();
                    hasIP     = true;
                }
            }
            if (!hasIP)
            {
                UseLegacyNetwork = false;
                UseWebNetwork    = false;
            }
#if !MONO
            bool createdOwn;
            bool createdOther;
            m_OwnWaitHandle      = new System.Threading.EventWaitHandle(false, System.Threading.EventResetMode.ManualReset, "AresSettingsEvent" + m_ID, out createdOwn);
            m_OtherWaitHandle    = new System.Threading.EventWaitHandle(false, System.Threading.EventResetMode.ManualReset, "AresSettingsEvent" + (m_ID == PlayerID ? EditorID : PlayerID), out createdOther);
            m_SharedMemoryThread = new System.Threading.Thread(ListenForSMChanges);
            m_ContinueSMThread   = true;
            m_SharedMemoryThread.Start();
#endif
            return(success);
        }
 public PinItemViewRenderer(Android.Content.Context context) : base(context)
 {
 }
        public TokenCallbackImplementation(Android.Content.Context c)
        {
            this.context = c;

            return;
        }
 public AutoSuggestBoxRenderer(Android.Content.Context context) : base(context)
 {
 }
Beispiel #31
0
 public PictureLoader(Context context, Uri uri, string[] projection, string selection, string[] selectionArgs, string sortOrder, bool capture) : base(context, uri, projection, selection, selectionArgs, sortOrder)
 {
     mEnableCapture = capture;
 }
Beispiel #32
0
 public BottomNavigationBar(Context context, IAttributeSet attrs) : this(context, attrs, 0)
 {
 }
 public F9pLayoutRenderer(Android.Content.Context context) : base(context)
        public static SpannableString ToAttributed(this FormattedString formattedString,
                                                   Android.Content.Context context,
                                                   FontAttributes attr,
                                                   Xamarin.Forms.Color defaultForegroundColor,
                                                   double textSize)
        {
            if (formattedString == null)
            {
                return(null);
            }

            var builder = new StringBuilder();

            for (int i = 0; i < formattedString.Spans.Count; i++)
            {
                Span span = formattedString.Spans[i];
                var  text = span.Text;
                if (text == null)
                {
                    continue;
                }

                builder.Append(text);
            }

            var spannable = new SpannableString(builder.ToString());

            var c = 0;

            for (int i = 0; i < formattedString.Spans.Count; i++)
            {
                Span span = formattedString.Spans[i];
                var  text = span.Text;
                if (text == null)
                {
                    continue;
                }

                int start = c;
                int end   = start + text.Length;
                c = end;

                if (span.TextColor != Xamarin.Forms.Color.Default)
                {
                    spannable.SetSpan(new ForegroundColorSpan(span.TextColor.ToAndroid()),
                                      start,
                                      end,
                                      SpanTypes.InclusiveExclusive);
                }
                else if (defaultForegroundColor != Xamarin.Forms.Color.Default)
                {
                    spannable.SetSpan(new ForegroundColorSpan(defaultForegroundColor.ToAndroid()),
                                      start,
                                      end,
                                      SpanTypes.InclusiveExclusive);
                }

                if (span.BackgroundColor != Xamarin.Forms.Color.Default)
                {
                    spannable.SetSpan(new BackgroundColorSpan(span.BackgroundColor.ToAndroid()),
                                      start,
                                      end,
                                      SpanTypes.InclusiveExclusive);
                }

                spannable.SetSpan(new TypefaceSpan(
                                      context,
                                      TypefaceFactory.GetTypefaceForFontAttribute(context, attr), textSize),
                                  start,
                                  end,
                                  SpanTypes.InclusiveInclusive);
            }
            return(spannable);
        }
Beispiel #35
0
        protected override Android.Views.View GetCellCore(Xamarin.Forms.Cell item, Android.Views.View convertView, Android.Views.ViewGroup parent, Android.Content.Context context)
        {
            var x = (NativeCell)item;

            var view = convertView;

            if (view == null)              // no view to re-use, create new
            {
                view = (context as Activity).LayoutInflater.Inflate(Resource.Layout.NativeAndroidCell, null);
            }

            view.FindViewById <TextView>(Resource.Id.Text1).Text = x.Name;
            view.FindViewById <TextView>(Resource.Id.Text2).Text = x.Category;

//			var i = view.Resources.GetIdentifier (item.ImageFilename, "drawable", context.PackageName);
//			view.FindViewById<ImageView>(Resource.Id.Image).SetImageResource(i);

            // HACK: this makes for choppy scrolling I think :-(
            context.Resources.GetBitmapAsync(x.ImageFilename).ContinueWith((t) => {
                view.FindViewById <ImageView> (Resource.Id.Image).SetImageBitmap(t.Result);
            });

            return(view);
        }
Beispiel #36
0
 public PlaybackSliderRenderer(Android.Content.Context context) : base(context)
 {
 }
Beispiel #37
0
 public LNLinearLayout(Android.Content.Context context, IAttributeSet attrs) : base(context, attrs)
 {
 }
 public ResourcesService(Android.Content.Context applicationContext)
 {
     this._applicationContext = applicationContext;
 }
Beispiel #39
0
		static Application()
		{
			context = Android.App.Application.Context;

			return;
		}
Beispiel #40
0
#pragma warning restore CS0618 // Type or member is obsolete

        public LabelRenderer(Android.Content.Context context) : base(context)
            => InstanceInit();
		public AuthenticateUIType GetUI (UIContext context)
		{
			this.context = context;
			return GetPlatformUI (context);
		}
Beispiel #42
0
 public SimpleCheck(AContext context, Color color) : this(context) => Color = color;
Beispiel #43
0
		public UserInfo (Android.Content.Context  context)
		{
			this.context = context;
		}
Beispiel #44
0
 public LNLinearLayout(Android.Content.Context context) : base(context)
 {
 }
Beispiel #45
0
 public Setup(Android.Content.Context applicationContext) : base(applicationContext)
 {
 }
		/// <summary>
		/// Gets the UI to present this form.
		/// </summary>
		/// <returns>
		/// The UI that needs to be presented.
		/// </returns>
		protected override AuthenticateUIType GetPlatformUI (UIContext context)
		{
			var i = new global::Android.Content.Intent (context, typeof (FormAuthenticatorActivity));
			var state = new FormAuthenticatorActivity.State {
				Authenticator = this,
			};
			i.PutExtra ("StateKey", FormAuthenticatorActivity.StateRepo.Add (state));
			return i;
		}
Beispiel #47
0
        /// <summary>
        /// Start the application context
        /// </summary>
        public static bool Start(A.Content.Context launcherActivity, A.Content.Context context, A.App.Application application)
        {
            var retVal = new AndroidApplicationContext();

            retVal.Context = context;
            retVal.m_configurationManager = new ConfigurationManager();
            retVal.AndroidApplication     = application;

            // Not configured
            if (!retVal.ConfigurationManager.IsConfigured)
            {
                NoConfiguration?.Invoke(null, EventArgs.Empty);
                return(false);
            }
            else
            { // load configuration
                try
                {
                    // Set master application context
                    ApplicationContext.Current = retVal;
                    retVal.CurrentActivity     = launcherActivity;
                    try
                    {
                        retVal.ConfigurationManager.Load();
                        retVal.ConfigurationManager.Backup();
                    }
                    catch
                    {
                        if (retVal.ConfigurationManager.HasBackup() &&
                            retVal.Confirm(Strings.err_configuration_invalid_restore_prompt))
                        {
                            retVal.ConfigurationManager.Restore();
                            retVal.ConfigurationManager.Load();
                        }
                        else
                        {
                            throw;
                        }
                    }

                    retVal.AddServiceProvider(typeof(AndroidBackupService));

                    retVal.m_tracer = Tracer.GetTracer(typeof(AndroidApplicationContext), retVal.ConfigurationManager.Configuration);

                    // Is there a backup, and if so, does the user want to restore from that backup?
                    var backupSvc = retVal.GetService <IBackupService>();
                    if (backupSvc.HasBackup(BackupMedia.Public) &&
                        retVal.Configuration.GetAppSetting("ignore.restore") == null &&
                        retVal.Confirm(Strings.locale_confirm_restore))
                    {
                        backupSvc.Restore(BackupMedia.Public);
                    }

                    // Ignore restoration
                    if (!retVal.Configuration.GetSection <ApplicationConfigurationSection>().AppSettings.Any(o => o.Key == "ignore.restore"))
                    {
                        retVal.Configuration.GetSection <ApplicationConfigurationSection>().AppSettings.Add(new AppSettingKeyValuePair()
                        {
                            Key   = "ignore.restore",
                            Value = "true"
                        });
                    }

                    // HACK: For some reason the PCL doesn't do this automagically
                    //var connectionString = retVal.Configuration.GetConnectionString("openIzWarehouse");
                    //if (!File.Exists(connectionString.Value))
                    //{
                    //    retVal.m_tracer.TraceInfo("HAX: Creating warehouse file since PCL can't... {0}", connectionString.Value);
                    //    SqliteConnection.CreateFile(connectionString.Value);
                    //}
                    // Load configured applets
                    var configuredApplets = retVal.Configuration.GetSection <AppletConfigurationSection>().Applets;

                    retVal.SetProgress(context.GetString(Resource.String.startup_configuration), 0.2f);
                    var appletManager = retVal.GetService <IAppletManagerService>();

                    // Load all user-downloaded applets in the data directory
                    foreach (var appletInfo in configuredApplets)// Directory.GetFiles(this.m_configuration.GetSection<AppletConfigurationSection>().AppletDirectory)) {
                    {
                        try
                        {
                            retVal.m_tracer.TraceInfo("Loading applet {0}", appletInfo);
                            String appletPath = Path.Combine(retVal.Configuration.GetSection <AppletConfigurationSection>().AppletDirectory, appletInfo.Id);

                            if (!File.Exists(appletPath)) // reinstall
                            {
                                retVal.Configuration.GetSection <AppletConfigurationSection>().Applets.Clear();
                                retVal.SaveConfiguration();
                                retVal.Alert(Strings.locale_restartRequired);
                                throw new AppDomainUnloadedException();
                            }

                            // Load
                            using (var fs = File.OpenRead(appletPath))
                            {
                                AppletManifest manifest = AppletManifest.Load(fs);
                                // Is this applet in the allowed applets

                                // public key token match?
                                if (appletInfo.PublicKeyToken != manifest.Info.PublicKeyToken)
                                {
                                    retVal.m_tracer.TraceWarning("Applet {0} failed validation", appletInfo);
                                    ; // TODO: Raise an error
                                }

                                appletManager.LoadApplet(manifest);
                            }
                        }
                        catch (AppDomainUnloadedException) { throw; }
                    }
                    catch (Exception e)
                    {
                        retVal.m_tracer.TraceError("Applet Load Error: {0}", e);
                        if (retVal.Confirm(String.Format(Strings.err_applet_corrupt_reinstall, appletInfo.Id)))
                        {
                            String appletPath = Path.Combine(retVal.Configuration.GetSection <AppletConfigurationSection>().AppletDirectory, appletInfo.Id);
                            if (File.Exists(appletPath))
                            {
                                File.Delete(appletPath);
                            }
                        }
                        else
                        {
                            retVal.m_tracer.TraceError("Loading applet {0} failed: {1}", appletInfo, e.ToString());
                            throw;
                        }
                    }

                    // Are we going to deploy applets
                    // Upgrade applets from our app manifest
                    foreach (var itm in context.Assets.List("Applets"))
                    {
                        try
                        {
                            retVal.m_tracer.TraceVerbose("Loading {0}", itm);
                            AppletPackage pkg = AppletPackage.Load(context.Assets.Open(String.Format("Applets/{0}", itm)));

                            // Write data to assets directory
#if !DEBUG
                            if (appletManager.GetApplet(pkg.Meta.Id) == null || new Version(appletManager.GetApplet(pkg.Meta.Id).Info.Version) < new Version(pkg.Meta.Version))
#endif
                            appletManager.Install(pkg, true);
                        }
                        catch (Exception e)
                        {
                            retVal.m_tracer?.TraceError(e.ToString());
                        }
                    }

                    // Ensure data migration exists
                    try
                    {
                        // If the DB File doesn't exist we have to clear the migrations
                        if (!File.Exists(retVal.Configuration.GetConnectionString(retVal.Configuration.GetSection <DataConfigurationSection>().MainDataSourceConnectionStringName).Value))
                        {
                            retVal.m_tracer.TraceWarning("Can't find the OpenIZ database, will re-install all migrations");
                            retVal.Configuration.GetSection <DataConfigurationSection>().MigrationLog.Entry.Clear();
                        }
                        retVal.SetProgress(context.GetString(Resource.String.startup_data), 0.6f);

                        DataMigrator migrator = new DataMigrator();
                        migrator.Ensure();

                        // Set the entity source
                        EntitySource.Current = new EntitySource(retVal.GetService <IEntitySourceProvider>());

                        ApplicationServiceContext.Current  = ApplicationContext.Current;
                        ApplicationServiceContext.HostType = OpenIZHostType.MobileClient;
                    }
                    catch (Exception e)
                    {
                        retVal.m_tracer.TraceError(e.ToString());
                        throw;
                    }
                    finally
                    {
                        retVal.ConfigurationManager.Save();
                    }

                    // Is there a backup manager? If no then we will use the default backup manager


                    // Start daemons
                    ApplicationContext.Current.GetService <IUpdateManager>().AutoUpdate();
                    retVal.GetService <IThreadPoolService>().QueueNonPooledWorkItem(o => { retVal.Start(); }, null);

                    // Set the tracer writers for the PCL goodness!
                    foreach (var itm in retVal.Configuration.GetSection <DiagnosticsConfigurationSection>().TraceWriter)
                    {
                        OpenIZ.Core.Diagnostics.Tracer.AddWriter(itm.TraceWriter, itm.Filter);
                    }
                }
Beispiel #48
0
		/// <summary>
		/// Gets the UI for this authenticator.
		/// </summary>
		/// <returns>
		/// The UI that needs to be presented.
		/// </returns>
		protected override AuthenticateUIType GetPlatformUI (UIContext context)
		{
			var i = new global::Android.Content.Intent (context, typeof (WebAuthenticatorActivity));
			i.PutExtra ("ClearCookies", ClearCookiesBeforeLogin);
			var state = new WebAuthenticatorActivity.State {
				Authenticator = this,
			};
			i.PutExtra ("StateKey", WebAuthenticatorActivity.StateRepo.Add (state));
			return i;
		}
Beispiel #49
0
 public FitWindowLayout(Context context) : base(context)
 {
 }
		protected abstract AuthenticateUIType GetPlatformUI (UIContext context);
 public BindableSwitchCompat(Android.Content.Context context, IAttributeSet attrs, int defStyle)
     : base(context, attrs, defStyle)
 {
     InitializeBinder();
 }