Esempio n. 1
0
 // ----------------------------------------------------------------------------------------------------------------
 // Determines the appropriate response if a particular button has been pressed.
 private void determineResponse(bool isReplay)
 {
     if (chronometer != null)
     {
         chronometer.Stop();
         chronometer = null;
     }
     if (logic != null)
     {
         logic.deleteBoard();
         logic = null;
     }
     if (sensorOn)
     {
         sensorSwitch(false);
     }
     if (isReplay)
     {
         GlobalApp.BeginActivity(this, typeof(DiceRollsActivity), GlobalApp.getVariableDifficultyName(), Intent.GetIntExtra(GlobalApp.getVariableDifficultyName(), 1), GlobalApp.getVariableChoiceName(), Intent.GetIntExtra(GlobalApp.getVariableChoiceName(), 0));
     }
     else
     {
         GlobalApp.BeginActivity(this, typeof(GameMenuActivity), GlobalApp.getVariableChoiceName(), Intent.GetIntExtra(GlobalApp.getVariableChoiceName(), 0));
     }
 }
        private void Deserialize(Stream stream, bool closeStream)
        {
            if (stream == null || !stream.CanRead)
            {
                throw new ArgumentException("stream");
            }

            try
            {
                using (var txtReader = new StreamReader(stream))
                    using (var jsonReader = new JsonTextReader(txtReader))
                    {
                        var result = ser.Deserialize <SerializeWrapper>(jsonReader);

                        FileVersion = result.FileVersion;

                        ExeAppsRegistry = result.ExeAppsRegistry;
                        GlobalApp       = result.GlobalApp;
                    }
            }
            catch (Exception)
            {
                if (closeStream)
                {
                    stream.Dispose();
                }
                throw;
            }
        }
Esempio n. 3
0
       public StreamManager(Context context)
        {

            if (context == null)
                throw new ArgumentNullException("context");
            this.context = context;
            StreamStatusToast = Toast.MakeText(context, string.Empty, ToastLength.Long);
            app = ((GlobalApp)context.ApplicationContext);
        }
Esempio n. 4
0
 public TextToSpeechManager(Context context)
 {
     if (context == null)
         throw new ArgumentNullException("context");
     this.context = context;
     app = ((GlobalApp)context.ApplicationContext);
     if (mTts == null)
         mTts = new TextToSpeech(context, this);
     lockObject = new object();
 }
Esempio n. 5
0
 public MainEventHandlers(Context context)
 {
     if (context == null)
         throw new ArgumentNullException("context");
     this.context = context;
     app = ((GlobalApp)context.ApplicationContext);
     ConnectStatusToast = Toast.MakeText(context, string.Empty, ToastLength.Long);
     TapjoyManager.Initialize(context);
     TapjoyManager.Connect(delegate
         {
             if (SetMenuVisibility != null)
                 SetMenuVisibility.Invoke();
         });
 }
Esempio n. 6
0
 private TapjoyManager(Context context)
 {
     if (context == null)
         throw new ArgumentNullException("context");
     this.context = context;
     TapjoyToast = Toast.MakeText(context, string.Empty, ToastLength.Short);
     app = ((GlobalApp)context.ApplicationContext);
     StreamPrice = context.Resources.GetInteger(Resource.Integer.tapjoy_stream_price);
     connectListener = new ConnectListener();
     streamSpentListener = new CurrencySpentListener();
     streamPlacementListener = new PlacementListener();
     earnedListener = new CurrencyEarnedListener();
     videoListener = new VideoListener();
 }
Esempio n. 7
0
 // ----------------------------------------------------------------------------------------------------------------
 // The game has ended so the score, and time will passed to userInputActivity.
 private void end()
 {
     try
     {
         chronometer.Stop();
         string playersScore = LeaderBoardInterface.formatLeaderBoardScore("", score.ToString(), Intent.GetIntExtra(GlobalApp.getVariableDifficultyName(), 1), chronometer.Text);
         GlobalApp.BeginActivity(this, typeof(UserInputActivity), GlobalApp.getPlayersScoreVariable(), playersScore,
                                 GlobalApp.getVariableChoiceName(), Intent.GetIntExtra(GlobalApp.getVariableChoiceName(), 0));
     }
     catch
     {
         GlobalApp.Alert(this, 0);
     }
 }
Esempio n. 8
0
        protected async override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.about_activity);
            mToolbar = FindViewById<Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);
            SetSupportActionBar(mToolbar);
            SupportActionBar.SetDisplayShowHomeEnabled(true);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.Title = GetString(Resource.String.AboutTitle);
            layoutAbout = FindViewById<LinearLayout>(Resource.Id.layoutAboutSecondary);
            app = (GlobalApp)ApplicationContext;
            lbVersion = FindViewById<TextView>(Resource.Id.lbVersion);
            lbRelaseName = FindViewById<TextView>(Resource.Id.lbRelaseName);
            lbAndroidSerial = FindViewById<TextView>(Resource.Id.lbAndroidSerial);
            lbAndroidId = FindViewById<TextView>(Resource.Id.lbAndroidId);
            lbAndroidVersion = FindViewById<TextView>(Resource.Id.lbAndroidVersion);
            lbManufacturer = FindViewById<TextView>(Resource.Id.lbManufacturer);
            lbDeviceModel = FindViewById<TextView>(Resource.Id.lbDeviceModel);
            //lbMac = FindViewById<TextView>(Resource.Id.lbMac);
            lbAdvertisingId = FindViewById<TextView>(Resource.Id.lbAdvertisingId);
            btnCoins = FindViewById<Button>(Resource.Id.btnCoins);
            btnCoins.Click += (sender, e) =>
            Dialogs.BuildDialog(this, "Info", GetString(Resource.String.coins_explanation), (args, ed) =>
                {
                }, null, null, Android.Resource.String.Ok, 0, 0).Show();
            lbRelaseName.Text += ":  " + app.ReleaseName;
            try
            {
                PackageManager manager = this.PackageManager;
                PackageInfo info = manager.GetPackageInfo(this.PackageName, 0);
                lbVersion.Text += ":  " + info.VersionName;
            }
            catch (Exception)
            {
                Log.Debug(TAG, "Failed to obtain current application version name and version code");
            }

            DeviceInfo.ObtainInfo(this);

            lbAndroidSerial.Text += ":  " + DeviceInfo.AndroidSerial;
            lbAndroidId.Text += ":  " + DeviceInfo.AndroidID;
            lbAndroidVersion.Text += ":  " + DeviceInfo.AndroidVersion;
            lbManufacturer.Text += ":  " + DeviceInfo.Manufacturer;
            lbDeviceModel.Text += ":  " + DeviceInfo.DeviceModel;
            //lbMac.Text += ":  " + DeviceInfo.MacAddress;

            var id = await GetAdvertisingId();
            lbAdvertisingId.Text += ":  " + id;
        }
Esempio n. 9
0
        // ----------------------------------------------------------------------------------------------------------------
        // Builds all the disks, and adds then into the first LinearLayout;
        private void createDisks()
        {
            int numberOfDisks = Intent.GetIntExtra(GlobalApp.getVariableDifficultyName(), 1);

            for (int i = 0; i < numberOfDisks; i++)
            {
                ImageView imgView = getResizedImage(i);

                // Add the view (imgView) into the linearlayout, with the added effect of the disks appearing in ascending order.
                linearLayout[0].AddView(imgView, 0);

                //Only the top disk is allowed to be clickable.
                topDiskIsOnlyClickable();
            }
        }
        public IActionResult Radicar()
        {
            UserSystemCompanyStatementModel userSystemCompanyStatementModel = new UserSystemCompanyStatementModel();
            var ConsultUserRemitent = GlobalApp.GetUserSystemResponseR(_httpContextAccessor.HttpContext.Session);

            userSystemCompanyStatementModel.UserSystemRemitent = ConsultUserRemitent;
            var ConsultUserDestinate = GlobalApp.GetUserSystemResponseD(_httpContextAccessor.HttpContext.Session);

            userSystemCompanyStatementModel.UserSystemDestinate = ConsultUserDestinate;

            CompanyStatementModel companyStatementModel = new CompanyStatementModel();

            userSystemCompanyStatementModel.CompanyStatement = companyStatementModel;
            return(View(userSystemCompanyStatementModel));
        }
        public JsonGestureIntentStore(string jsonPath, string fileVersion)
        {
            FileVersion = fileVersion;
            this.jsonPath = jsonPath;
            SetupSerializer();

            if (File.Exists(jsonPath))
            {
                Deserialize();
            }
            else
            {
                Apps = new Dictionary<string, ExeApp>();
                GlobalApp = new GlobalApp();
            }
        }
        public JsonGestureIntentStore(string jsonPath, string fileVersion)
        {
            FileVersion   = fileVersion;
            this.jsonPath = jsonPath;
            SetupSerializer();


            if (File.Exists(jsonPath))
            {
                Deserialize();
            }
            else
            {
                Apps      = new Dictionary <string, ExeApp>();
                GlobalApp = new GlobalApp();
            }
        }
Esempio n. 13
0
        public JsonGestureIntentStore(string jsonPath, string fileVersion)
        {
            FileVersion   = fileVersion;
            this.jsonPath = jsonPath;
            SetupSerializer();

            if (File.Exists(jsonPath))
            {
                Deserialize();
            }
            else
            {
                Apps              = new Dictionary <string, ExeApp>();
                GlobalApp         = new GlobalApp();
                HotCornerCommands = new AbstractCommand[8]; //4 corners + 4 edges
            }
        }
Esempio n. 14
0
        protected void Application_Start()
        {
            //AreaRegistration.RegisterAllAreas();
            //GlobalConfiguration.Configure(WebApiConfig.Register);
            //FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            //RouteConfig.RegisterRoutes(RouteTable.Routes);


            //Http Client Protocol Settings
            System.Net.ServicePointManager.Expect100Continue       = false;
            System.Net.ServicePointManager.MaxServicePointIdleTime = 60 * 60 * 1000;//60 Minutes
            ServicePointManager.DefaultConnectionLimit             = 132;


            FileInfo fi = new FileInfo(System.Web.Hosting.HostingEnvironment.ApplicationPhysicalPath + "\\web.config");

            log4net.Config.XmlConfigurator.ConfigureAndWatch(fi);

            Assembly     assem     = Assembly.GetExecutingAssembly();
            AssemblyName assemName = assem.GetName();

            AggieGlobalLogManager.Info("=================================================================");
            AggieGlobalLogManager.Info("Starting SKYSITE-Web-API-Service v{0}", assemName.Version);
            AggieGlobalLogManager.Info("=================================================================");

            AreaRegistration.RegisterAllAreas();

            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            FilterConfig.RegisterHttpFilters(GlobalConfiguration.Configuration.Filters);

            RouteConfig.RegisterRoutes(RouteTable.Routes);


            FormatterConfig.RegisterFormatters(GlobalConfiguration.Configuration.Formatters);
            HandlerConfig.RegisterHandlers(GlobalConfiguration.Configuration.MessageHandlers);

            //Instnatiate the one & only instance of GlobalApp - facade design pattern to Provide an unified interface to a set of interfaces to deal with business functions
            if (_theGlobalApp == null)
            {
                string dbConnectionStringName = "AggieGlobalDB";
                GlobalApp.Initialize(dbConnectionStringName);
                _theGlobalApp = GlobalApp.Instance;
            }
        }
        public JsonGestureIntentStore(string jsonPath)
        {
            this.jsonPath = jsonPath;

            ser.Formatting = Formatting.None;

            ser.TypeNameHandling = TypeNameHandling.Auto;


            if (File.Exists(jsonPath))
            {
                Deserialize();
            }
            else
            {
                ExeAppsRegistry = new Dictionary <string, ExeApp>();
                GlobalApp       = new GlobalApp();
            }
        }
Esempio n. 16
0
        public void Import(JsonGestureIntentStore from, bool replace = false)
        {
            if (from == null)
            {
                return;
            }

            if (replace)
            {
                GlobalApp.GestureIntents.Clear();
                GlobalApp.IsGesturingEnabled = from.GlobalApp.IsGesturingEnabled;
                Apps.Clear();
                HotCornerCommands = from.HotCornerCommands;
            }
            else
            {
                for (var i = 0; i < from.HotCornerCommands.Length; i++)
                {
                    if (from.HotCornerCommands[i] != null)
                    {
                        HotCornerCommands[i] = from.HotCornerCommands[i];
                    }
                }
            }

            GlobalApp.ImportGestures(from.GlobalApp);

            foreach (var kv in from.Apps)
            {
                ExeApp appInSelf;
                //如果应用程序已经在列表中,则合并手势
                if (TryGetExeApp(kv.Key.ToLower(), out appInSelf))
                {
                    appInSelf.ImportGestures(kv.Value);
                    appInSelf.IsGesturingEnabled = appInSelf.IsGesturingEnabled && kv.Value.IsGesturingEnabled;
                }
                else//否则将app添加到列表中
                {
                    Add(kv.Value);
                }
            }
        }
        public async Task <IActionResult> CompanyStatement(CompanyStatementModel companyStatementModel)
        {
            var ConsultUserRemitent  = GlobalApp.GetUserSystemResponseR(_httpContextAccessor.HttpContext.Session);
            var ConsultUserDestinate = GlobalApp.GetUserSystemResponseD(_httpContextAccessor.HttpContext.Session);

            CompanyStatementModel _companyStatementModel = new CompanyStatementModel();

            _companyStatementModel.NameFile       = companyStatementModel.NameFile;
            _companyStatementModel.Remitent       = ConsultUserRemitent.Id;
            _companyStatementModel.Destinatary    = ConsultUserDestinate.Id;
            _companyStatementModel.IsItInternally = companyStatementModel.IsItInternally;

            APIConsumption _aPIConsumption = new APIConsumption(_configuration);

            if (await _aPIConsumption.PostCompanyStatement(_companyStatementModel))
            {
                var _companyStatementConvertJsonResponse =
                    await _aPIConsumption.ConsultCompanyStatement();

                List <CompanyStatementModel> _companyStatementConvert = new List <CompanyStatementModel>();

                foreach (var item in _companyStatementConvertJsonResponse.data)
                {
                    CompanyStatementModel _model = new CompanyStatementModel();
                    _model.Id             = item.Id;
                    _model.NameFile       = item.NameFile;
                    _model.Remitent       = item.Remitent;
                    _model.Destinatary    = item.Destinatary;
                    _model.IsItInternally = item.IsItInternally;
                    _model.FilingNumber   = item.FilingNumber;
                    _companyStatementConvert.Add(_model);
                }

                ViewBag.listCompanyStatement = _companyStatementConvert;

                return(View(_companyStatementConvert));
            }
            ;


            return(RedirectToAction("Radicar"));
        }
Esempio n. 18
0
        protected override void OnCreate(Bundle bundle)
        {
            try
            {
                base.OnCreate(bundle);
                SetContentView(Resource.Layout.TowersOfHanoi);

                btnReplay = FindViewById <Button>(Resource.Id.btnReplay);
                Button   btnQuit             = FindViewById <Button>(Resource.Id.btnQuit);
                TextView txtOptimalNoOfMoves = FindViewById <TextView>(Resource.Id.txtViewOptNoOfMoves);
                chronometer = FindViewById <Chronometer>(Resource.Id.cTimer);
                elapsedTime = FindViewById <TextView>(Resource.Id.txtVElapsedTime);
                txtVScore   = FindViewById <TextView>(Resource.Id.txtVScore);
                gameDisplay = FindViewById <LinearLayout>(Resource.Id.linLayGameDisplay);
                // Build the game display that the user will interact with;
                btnReplay.Enabled = false;
                Game();

                // Initializing data for the game.
                logic = new GameLogic.TowersOfHanoiLogic(MAXCOMPONENTS, Intent.GetIntExtra(GlobalApp.getVariableDifficultyName(), 1));
                txtOptimalNoOfMoves.Text = string.Format("{0}", "Optimal no. of moves: " + logic.calOptimalNoOfMoves(Intent.GetIntExtra(GlobalApp.getVariableDifficultyName(), 1)));
                txtVScore.Text           = "No. of moves: " + 0;
                chronometer.Visibility   = ViewStates.Invisible;

                // Event handlers:
                btnReplay.Click             += btnReplayOnClick;
                btnQuit.Click               += btnQuitOnClick;
                chronometer.ChronometerTick += chronometerOnTick;

                // Begin the timer;
                chronometer.Start();
            }
            catch
            {
                GlobalApp.Alert(this, 0);
            }
        }
Esempio n. 19
0
        // ----------------------------------------------------------------------------------------------------------------
        // Adds numbers to each of the disks, as some players may find it hard to differentiate between disks.
        // Particularly if there are alot of them.
        private Bitmap addNumbersToBitMap(Bitmap bMapDiskScaled, int count)
        {
            int number = Intent.GetIntExtra(GlobalApp.getVariableDifficultyName(), 1) - count;
            // The top left hand corner of the image of the number is specified by the (x,y)
            // the number will not be placed exactly in the middle, instead it will be slightly off centre.
            // The 0.15 (15%), and 0.10 (10%) have been determined by testing different values
            // To find the optimal (x,y) values so the image looks to be in the middle of the Bitmap.
            float x = (float)((bMapDiskScaled.Width / 2) - (bMapDiskScaled.Height * 0.15));
            float y = (float)(bMapDiskScaled.Height - (bMapDiskScaled.Height * 0.10));

            // The bitmap must be immutable otherwise it will through an exception, if changes are permitted.
            bMapDiskScaled = bMapDiskScaled.Copy(Bitmap.Config.Argb8888, true);
            Canvas canvas = new Canvas(bMapDiskScaled);
            Paint  paint  = new Paint();

            paint.Color = Color.Black;

            // Again different values were tested to find the best text size.
            paint.TextSize = (int)(bMapDiskScaled.Height - (bMapDiskScaled.Height * 0.05));

            // Now draw the number at the specified x, and y coordinates.
            canvas.DrawText(String.Format("{0}", number), x, y, paint);
            return(bMapDiskScaled);
        }
        private void Deserialize(Stream stream, bool closeStream)
        {
            if (stream == null || !stream.CanRead)
            {
                throw new ArgumentException("stream");
            }
            try
            {
                using (var txtReader = new StreamReader(stream))
                    using (var jsonReader = new JsonTextReader(txtReader))
                    {
                        var ser = new JsonSerializer();
                        ser.Formatting       = Formatting.None;
                        ser.TypeNameHandling = TypeNameHandling.Auto;

                        if (FileVersion.Equals("1"))
                        {
                            ser.Converters.Add(new GestureIntentConverter_V1());
                        }
                        else if (FileVersion.Equals("2"))
                        {
                            ser.Converters.Add(new GestureIntentConverter());
                        }
                        var result = ser.Deserialize <SerializeWrapper>(jsonReader);

                        FileVersion = result.FileVersion;
                        GlobalApp   = result.Global;
                        //Apps = result.Apps;

                        Apps = new Dictionary <string, ExeApp>();

                        //to lower
                        foreach (var a in result.Apps.Values)
                        {
                            a.ExecutablePath = a.ExecutablePath.ToLower();
                            Apps.Add(a.ExecutablePath, a);
                        }
                    }
            }
            finally
            {
                if (closeStream)
                {
                    stream.Dispose();
                }
            }

            //todo: 完全在独立domain中加载json.net?

            /*var deserializeDomain = AppDomain.CreateDomain("jsonDeserialize");
             * deserializeDomain.UnhandledException += (sender, args) => { throw new IOException(args.ExceptionObject.ToString()); };
             * deserializeDomain.DomainUnload += (sender, args) =>
             * {
             *  Console.WriteLine("deserializeDomain Unloaded");
             * };
             * var wrapperRef = (ISerializeWrapper)deserializeDomain.CreateInstanceAndUnwrap("SerializeWrapper", "SerializeWrapper.SerializeWrapper");
             *
             * wrapperRef.DeserializeFromStream(stream, FileVersion, closeStream);
             *
             * GlobalApp = wrapperRef.Global;
             * Apps = wrapperRef.Apps;
             *
             * wrapperRef = null;
             *
             * GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced);
             * GC.WaitForPendingFinalizers();
             *
             * AppDomain.Unload(deserializeDomain);
             * deserializeDomain = null;
             *
             * GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced);
             * GC.WaitForPendingFinalizers();*/
        }
        private void Deserialize(Stream stream, bool closeStream)
        {
            if(stream == null || !stream.CanRead) throw new ArgumentException("stream");
            try
            {
                using (var txtReader = new StreamReader(stream))
                using (var jsonReader = new JsonTextReader(txtReader))
                {
                    var ser = new JsonSerializer();
                    ser.Formatting = Formatting.None;
                    ser.TypeNameHandling = TypeNameHandling.Auto;

                    if (FileVersion.Equals("1"))
                    {
                        ser.Converters.Add(new GestureIntentConverter_V1());

                    }
                    else if (FileVersion.Equals("2"))
                    {
                        ser.Converters.Add(new GestureIntentConverter());

                    }
                    var result = ser.Deserialize<SerializeWrapper>(jsonReader);

                    FileVersion = result.FileVersion;
                    GlobalApp = result.Global;
                    //Apps = result.Apps;

                    Apps = new Dictionary<string, ExeApp>();

                    //to lower
                    foreach(var a in result.Apps.Values)
                    {
                        a.ExecutablePath = a.ExecutablePath.ToLower();
                        Apps.Add(a.ExecutablePath, a);
                    }

                }
            }
            finally
            {
                if (closeStream) stream.Dispose();
            }

            //todo: 完全在独立domain中加载json.net?
            /*var deserializeDomain = AppDomain.CreateDomain("jsonDeserialize");
            deserializeDomain.UnhandledException += (sender, args) => { throw new IOException(args.ExceptionObject.ToString()); };
            deserializeDomain.DomainUnload += (sender, args) =>
            {
                Console.WriteLine("deserializeDomain Unloaded");
            };
            var wrapperRef = (ISerializeWrapper)deserializeDomain.CreateInstanceAndUnwrap("SerializeWrapper", "SerializeWrapper.SerializeWrapper");

            wrapperRef.DeserializeFromStream(stream, FileVersion, closeStream);

            GlobalApp = wrapperRef.Global;
            Apps = wrapperRef.Apps;

            wrapperRef = null;

            GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced);
            GC.WaitForPendingFinalizers();

            AppDomain.Unload(deserializeDomain);
            deserializeDomain = null;

            GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced);
            GC.WaitForPendingFinalizers();*/
        }
Esempio n. 22
0
        private bool SaveApplication()
        {
            if (_currentApplication is GlobalApp)
            {
                GlobalApp globalApp = (GlobalApp)_currentApplication;
                int       newValue  = (int)LimitNumberOfFingersSlider.Value;;
                if (newValue != globalApp.LimitNumberOfFingers)
                {
                    globalApp.LimitNumberOfFingers = newValue;
                    ApplicationManager.Instance.SaveApplications();
                }
                return(true);
            }

            string matchString = MatchStringTextBox.Text.Trim();

            if (string.IsNullOrEmpty(matchString))
            {
                return(ShowErrorMessage(
                           LocalizationProvider.Instance.GetTextValue("ApplicationDialog.Messages.EmptyStringTitle"),
                           LocalizationProvider.Instance.GetTextValue("ApplicationDialog.Messages.EmptyString")));
            }

            string name = ApplicationNameTextBox.Text.Trim();

            switch (_currentApplication)
            {
            case UserApp userApp:
            {
                string groupName = string.IsNullOrWhiteSpace(GroupComboBox.Text) ? null : GroupComboBox.Text.Trim();

                if (string.IsNullOrWhiteSpace(name))
                {
                    return(ShowErrorMessage(
                               LocalizationProvider.Instance.GetTextValue("ApplicationDialog.Messages.NoApplicationNameTitle"),
                               LocalizationProvider.Instance.GetTextValue("ApplicationDialog.Messages.NoApplicationName")));
                }

                var newApplication = new UserApp
                {
                    BlockTouchInputThreshold = (int)BlockTouchInputSlider.Value,
                    LimitNumberOfFingers     = (int)LimitNumberOfFingersSlider.Value,
                    Name           = name,
                    Group          = groupName,
                    MatchString    = matchString,
                    MatchUsing     = matchUsingRadio.MatchUsing,
                    MatchActivated = MatchActivatedCheckBox.IsChecked.GetValueOrDefault(),
                    IsRegEx        = RegexCheckBox.IsChecked.Value
                };

                if (_newApplication)
                {
                    //Add new UserApplication
                    var sameMatchApplications = ApplicationManager.Instance.FindMatchApplications <UserApp>(matchUsingRadio.MatchUsing, matchString);
                    if (sameMatchApplications.Length != 0)
                    {
                        string sameApp = sameMatchApplications.Aggregate <IApplication, string>(null, (current, app) => current + (app.Name + " "));
                        return
                            (ShowErrorMessage(LocalizationProvider.Instance.GetTextValue("ApplicationDialog.Messages.StringConflictTitle"),
                                              string.Format(LocalizationProvider.Instance.GetTextValue("ApplicationDialog.Messages.StringConflict"), matchString, sameApp)));
                    }

                    if (ApplicationManager.Instance.ApplicationExists(name))
                    {
                        return(ShowErrorMessage(
                                   LocalizationProvider.Instance.GetTextValue("ApplicationDialog.Messages.AppExistsTitle"),
                                   LocalizationProvider.Instance.GetTextValue("ApplicationDialog.Messages.AppExists")));
                    }
                    ApplicationManager.Instance.AddApplication(newApplication);
                }
                else
                {
                    var sameMatchApplications = ApplicationManager.Instance.FindMatchApplications <UserApp>(matchUsingRadio.MatchUsing, matchString, _currentApplication.Name);
                    if (sameMatchApplications.Length != 0)
                    {
                        string sameApp = sameMatchApplications.Aggregate <IApplication, string>(null, (current, app) => current + (app.Name + " "));
                        return(ShowErrorMessage(
                                   LocalizationProvider.Instance.GetTextValue("ApplicationDialog.Messages.StringConflictTitle"),
                                   string.Format(LocalizationProvider.Instance.GetTextValue("ApplicationDialog.Messages.StringConflict"), matchString, sameApp)));
                    }

                    if (name != _currentApplication.Name && ApplicationManager.Instance.ApplicationExists(name))
                    {
                        return(ShowErrorMessage(
                                   LocalizationProvider.Instance.GetTextValue("ApplicationDialog.Messages.AppExistsTitle"),
                                   LocalizationProvider.Instance.GetTextValue("ApplicationDialog.Messages.AppExists")));
                    }

                    newApplication.Actions = _currentApplication.Actions;
                    ApplicationManager.Instance.ReplaceApplication(_currentApplication, newApplication);
                }
                break;
            }

            case IgnoredApp ignoredApp:
            {
                if (string.IsNullOrEmpty(name))
                {
                    name = matchString;
                }

                if (!_newApplication)
                {
                    var existingApp = ApplicationManager.Instance.FindMatchApplications <IgnoredApp>(matchUsingRadio.MatchUsing, matchString, _currentApplication.Name);
                    if (existingApp.Length != 0)
                    {
                        return(ShowErrorMessage(
                                   LocalizationProvider.Instance.GetTextValue("ApplicationDialog.Messages.IgnoredAppExistsTitle"),
                                   LocalizationProvider.Instance.GetTextValue("ApplicationDialog.Messages.IgnoredAppExists")));
                    }
                    ApplicationManager.Instance.RemoveApplication(_currentApplication);
                }
                else if (ApplicationManager.Instance.GetIgnoredApplications().Any(app => app.MatchUsing == matchUsingRadio.MatchUsing && app.MatchString == matchString))
                {
                    return(ShowErrorMessage(
                               LocalizationProvider.Instance.GetTextValue("ApplicationDialog.Messages.IgnoredAppExistsTitle"),
                               LocalizationProvider.Instance.GetTextValue("ApplicationDialog.Messages.IgnoredAppExists")));
                }

                ApplicationManager.Instance.AddApplication(new IgnoredApp(name, matchUsingRadio.MatchUsing, matchString, RegexCheckBox.IsChecked.Value, true));
                break;
            }
            }
            ApplicationManager.Instance.SaveApplications();
            return(true);
        }
 public IActionResult User()
 {
     ViewBag.GetDocument = GlobalApp.GetDocument(_httpContextAccessor.HttpContext.Session);
     ViewBag.GetTypeUser = GlobalApp.GetTypeUser(_httpContextAccessor.HttpContext.Session);
     return(View());
 }
        public async Task <IActionResult> User(UserSystemModel userSystemModel)
        {
            if (ModelState.IsValid)
            {
                APIConsumption _aPIConsumption = new APIConsumption(_configuration);
                var            _user           = await _aPIConsumption.ConsultUser(userSystemModel.Document);

                //Usuario ya registrado
                if (_user.data != null)
                {
                    UserSystemModel _userSystemModel = new UserSystemModel();
                    _userSystemModel.Id           = _user.data.Id;
                    _userSystemModel.NameUser     = _user.data.NameUser;
                    _userSystemModel.TypeDocument = _user.data.TypeDocument;
                    _userSystemModel.Document     = _user.data.Document;
                    _userSystemModel.Phone        = _user.data.Phone;
                    _userSystemModel.Email        = _user.data.Email;
                    _userSystemModel.AddressUser  = _user.data.AddressUser;
                    _userSystemModel.Password     = _user.data.Document;

                    if (userSystemModel.TypeUser == "Remitente")
                    {
                        GlobalApp.SetUserSystemResponseR(_httpContextAccessor.HttpContext.Session, _userSystemModel);
                    }
                    else if (userSystemModel.TypeUser == "Destinatario")
                    {
                        GlobalApp.SetUserSystemResponseD(_httpContextAccessor.HttpContext.Session, _userSystemModel);
                    }
                    return(RedirectToAction("Radicar"));
                }
                else if (userSystemModel.Email == null)
                {
                    GlobalApp.SetTypeUser(_httpContextAccessor.HttpContext.Session, userSystemModel.TypeUser);
                    GlobalApp.SetDocument(_httpContextAccessor.HttpContext.Session, userSystemModel.Document);
                    return(RedirectToAction("User"));
                }

                //Registrando Usuario
                if (await _aPIConsumption.PostUserSystemAsync(userSystemModel))
                {
                    var _user1 = await _aPIConsumption.ConsultUser(userSystemModel.Document);

                    if (_user1.data != null)
                    {
                        UserSystemModel _userSystemModel = new UserSystemModel();
                        _userSystemModel.Id           = _user1.data.Id;
                        _userSystemModel.NameUser     = _user1.data.NameUser;
                        _userSystemModel.TypeDocument = _user1.data.TypeDocument;
                        _userSystemModel.Document     = _user1.data.Document;
                        _userSystemModel.Phone        = _user1.data.Phone;
                        _userSystemModel.Email        = _user1.data.Email;
                        _userSystemModel.AddressUser  = _user1.data.AddressUser;
                        _userSystemModel.Password     = _user1.data.Document;

                        if (userSystemModel.TypeUser == "Remitente")
                        {
                            GlobalApp.SetUserSystemResponseR(_httpContextAccessor.HttpContext.Session, _userSystemModel);
                        }
                        else if (userSystemModel.TypeUser == "Destinatario")
                        {
                            //Se puede implementar el rol de destinatario
                            UserSystemRolesModel _userSystemRolesModel = new UserSystemRolesModel();
                            _userSystemRolesModel.Roles      = 1;
                            _userSystemRolesModel.UserSystem = _userSystemModel.Id;

                            await _aPIConsumption.PostUserRrolesSystemAsync(_userSystemRolesModel);

                            GlobalApp.SetUserSystemResponseD(_httpContextAccessor.HttpContext.Session, _userSystemModel);
                        }
                    }
                }
            }

            return(RedirectToAction("Radicar"));
        }
Esempio n. 25
0
        protected override void OnCreate(Bundle bundle)
        {
            try
            {
                base.OnCreate(bundle);
                SetContentView(Resource.Layout.TowersOfHanoi);

                _sensorManager = (SensorManager)GetSystemService(SensorService);
                sensorOn       = true;

                chronometer = FindViewById <Chronometer>(Resource.Id.cTimer);
                btnReplay   = FindViewById <Button>(Resource.Id.btnReplay);
                Button btnQuit = FindViewById <Button>(Resource.Id.btnQuit);
                txtOptimalNoOfMoves = FindViewById <TextView>(Resource.Id.txtViewOptNoOfMoves);
                elapsedTime         = FindViewById <TextView>(Resource.Id.txtVElapsedTime);
                txtVScore           = FindViewById <TextView>(Resource.Id.txtVScore);
                gameDisplay         = FindViewById <LinearLayout>(Resource.Id.linLayGameDisplay);


                // Build the game display that the user will interact with;
                btnReplay.Enabled = false;
                //detirmine how many dice will be displayed based on difficulty
                switch (Intent.GetIntExtra(GlobalApp.getVariableDifficultyName(), 1))
                {
                case 2:
                    maxComponents = 5;
                    break;

                case 3:
                    maxComponents = 4;
                    break;

                case 4:
                    maxComponents = 3;
                    break;

                case 5:
                    maxComponents = 2;
                    break;

                default:
                    maxComponents = 1;
                    break;
                }

                Game();

                logic                    = new GameLogic.DiceRollsLogic(maxComponents);
                txtVScore.Text           = "Score: " + 0;
                txtOptimalNoOfMoves.Text = "no. of Rolls: " + numberOfRolls;
                chronometer.Visibility   = ViewStates.Invisible;

                // Event handlers:
                btnReplay.Click             += btnReplayOnClick;
                btnQuit.Click               += btnQuitOnClick;
                chronometer.ChronometerTick += chronometerOnTick;

                // Begin the timer;
                chronometer.Start();
            }
            catch
            {
                GlobalApp.Alert(this, 0);
            }
        }
Esempio n. 26
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            InitializeInsights();

            //Read application wide values
            app = ((GlobalApp)this.ApplicationContext);
            app.Settings = ((PreferenceManager)app.PreferenceManager).LoadSettings(this);
            savedInstanceState = false;
            if (bundle != null)
            {
                selectedView = (MainEventHandlers.ViewsEnum)bundle.GetInt(selectedViewKey);
            }

            var tapjoyPayload = Intent.GetStringExtra(Tapjoy.Tapjoy.IntentExtraPushPayload);
            if (tapjoyPayload != null)
            {
                TapjoyManager.HandlePushPayload(tapjoyPayload);
            }

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.main_material);
            mToolbar = FindViewById<Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);
            SetSupportActionBar(mToolbar);
            SupportActionBar.SetDisplayShowHomeEnabled(true);
            IsTabletLandscapeLayout = (FindViewById<LinearLayout>(Resource.Id.tablet_layout) != null);
            ResetFragmentPositions();
            if (!IsTabletLandscapeLayout && drawerFragment == null)
            {
                drawerFragment = (FragmentDrawer)SupportFragmentManager.FindFragmentById(Resource.Id.fragment_navigation_drawer);
                drawerFragment.SetUpDrawer(Resource.Id.fragment_navigation_drawer, FindViewById<DrawerLayout>(Resource.Id.drawer_layout), mToolbar);
                drawerFragment.ListItemClicked += (sender, e) =>
                {
                    if (ConnectionManager.Connected)
                        DisplayView((MainEventHandlers.ViewsEnum)e.Position); 
                };
            }

            ReadSatellitesXml();

        }