/// <summary> /// <para>Disable the specified <paramref name="messageID"/> for being processed and forwared</para> /// </summary> /// <param name="messageID"></param> public void UnregisterEventForMessage(Classes.System.WindowsMessages messageID) { _lock.AcquireWriterLock(Timeout.Infinite); if (_messageSet.ContainsKey((int)messageID) && _messageSet[(int)messageID] > 1) _messageSet[(int)messageID]--; _lock.ReleaseWriterLock(); }
public Scoreboard(string guidFromMain = "", Classes.CustomSnapshotRoot root = null) { guid = guidFromMain; Classes.Logger.addLog("Opened scoreboard on server -> " + guid); InitializeComponent(); if(root != null) { Classes.ScoreboardRenderer render = new Classes.ScoreboardRenderer(this, root.snapshot.mapId, root); Classes.Logger.addLog("Enabled initial render: "); } else { _timer = new System.Timers.Timer(3000); _timer.Elapsed += new ElapsedEventHandler(_timer_Elapsed); _timer.Enabled = true; // Enable it _timer_Elapsed(this, null); } if(MainWindow.keeperSettings.ScoreboardBackgrounds == false) { BackgroundAnimation.Stop(); BackgroundAnimation.Visibility = Visibility.Hidden; } else { BackgroundAnimation.Play(); } }
//Konstruktor public Character(string charName, Classes className, int level, Animation standardAnimation, Animation attackAnimation, Animation deathAnimation) { this.Name = charName; this.Class = className; this.Level = level; this.SetInitiative(); this.ChangeAttributes(AttributesHelperClass.SetAttributes()); for (int i = Level; i > 0; i--) { this.ChangeAttributes(AttributesHelperClass.LevelUpAttributes(this.Class)); } this.SetFightAttributes(); this.Skills = new List<Skill>(); this.Statuseffects = new List<IStatuseffect>(); if (standardAnimation != null && attackAnimation != null && deathAnimation != null) { this.StandardAnimation = standardAnimation; this.AttackAnimation = attackAnimation; this.DeathAnimation = deathAnimation; } else { StandardAnimation = LoadContentHelper.PlaceHolderForStatics; AttackAnimation = LoadContentHelper.PlaceHolderForStatics; DeathAnimation = LoadContentHelper.PlaceHolderForStatics; } LoadSkillHelperClass.AddStandardSkills(this); this.IsMindBlown = false; }
//Gibt die Änderung der Festwerte der spezifischen Klasse bei Level Up zurück public static List<int> LevelUpAttributes(Classes charClass) { if (charClass.Equals(Classes.Warrior)) { return new List<int>() { 200, 5, 80, 40, 30, 1, 3 }; } if (charClass.Equals(Classes.DamageDealer)) { return new List<int>() { 200, 0, 80, 80, 15, 1, 6 }; } if (charClass.Equals(Classes.Coloss)) { return new List<int>() { 400, 0, 40, 40, 30, 2, 3 }; } if (charClass.Equals(Classes.Patron)) { return new List<int>() { 200, 5, 40, 80, 15, 2, 3 }; } if (charClass.Equals(Classes.Harasser)) { return new List<int>() { 400, 5, 40, 80, 15, 1, 3 }; } else { return new List<int>() { 0,0,0,0,0,0,0 }; } }
public PageMarks(Classes.Standard standard) { this.standard= standard; InitializeComponent(); init(); }
static void serialize(Classes.Character.Player playerToSerialize, string fileName) { IFormatter formatter = new BinaryFormatter(); Stream stream = new FileStream(fileName, FileMode.Create, FileAccess.Write, FileShare.None); formatter.Serialize(stream, playerToSerialize); stream.Close(); }
public Enemy(string charName, Classes className, int level, GUIElement staticEnemy, Animation standardAnimation, Animation attackAnimation, Animation deathAnimation, bool isAnimated) : base(charName, className, level, standardAnimation, attackAnimation, deathAnimation) { this.isAnimated = isAnimated; this.StaticEnemy = staticEnemy; LoadSkillHelperClass.AddSkillsForEnemy(this); }
static void EntryPoint() { // Класс - это лишь шаблон, свой тип данных // Программы манипулируют именно объектами // Создав класс, вы можете объявлять переменную этого типа так же, как и уже знакомых вам int, string Classes classInstance; // Точно так же вы можете объявить массив экземпляров вашего класса Classes[] classInstances; // Это только объявление. Инициализация таких переменных отличается от int, string, etc // Инициализация происходит с помощью ключевого слова new и вызова конструктора classInstance = new Classes(0); classInstances = new Classes[10]; // не путайте создание массива classInstances[0] = new Classes(10); // и создание объекта // После объявления вы можете пользоваться публичными элементами класса: полями, методами, свойствами string methodResult = classInstance.MakeSomething(42); int propertyValue = classInstance.ClassProperty; classInstance.ClassProperty = 24; // int fieldValue = classInstance._classField; - вызовет ошибку компиляции // Т.к. _classField объявлен private; }
private void ApproveApplication(Classes.WorkflowApplicationResponse ApplicationInfo) { try { this.textBox1.Text = string.Format("{0}\r\n{1}\r\n{2}", "Approval Message", ApplicationInfo.application, this.textBox1.Text); string _user = ApplicationInfo.user.Replace("//", @"\"); this.textBox1.Text = string.Format("{0}\r\n{1}\r\n{2}", "Querying SF for app", ApplicationInfo.application, this.textBox1.Text); var _applicationSubscription = _store.GetSubscriptionInfo(_user, ApplicationInfo.application); if (_applicationSubscription != null) { this.textBox1.Text = string.Format("{0}\r\n{1}\r\n{2}", "Subscription is not null", ApplicationInfo.application, this.textBox1.Text); this.textBox1.Text = string.Format("{0}\r\n{1}\r\n{2}", "Found app", ApplicationInfo.application, this.textBox1.Text); this.textBox1.Text = string.Format("{0}\r\n{1}\r\n{2}", "Updating app status", ApplicationInfo.application, this.textBox1.Text); _applicationSubscription.Status = SubscriptionStatus.subscribed; this.textBox1.Text = string.Format("{0}\r\n{1}\r\n{2}", "Saving status", ApplicationInfo.application, this.textBox1.Text); _store.SetSubscriptionInfo(_applicationSubscription); _store.SaveChanges(); } } catch(Exception e) { this.textBox1.Text = string.Format("{0}\r\n{1}", "Error", e.Message); } }
public FantasyNameSettings(Classes chosenclass, Race race, bool includeHomeland, bool includePostfix, Gender gender) { ChosenClass = chosenclass; ChosenRace = race; IncludeHomeland = includeHomeland; IncludePostfix = includePostfix; Gender = gender; }
public Configuration(BaseClass home) { Class = new Classes(this); Class.DeclareClasses(home); Class.Set.Title = new List<string>(); Class.Set.Data = new List<string>(); }
public void UpdateOne(Classes classe) { TPDataBaseEntities context = new TPDataBaseEntities(); Classes dbClasse = context.Classes.Find(classe.Id); dbClasse.Libelle = classe.Libelle; dbClasse.Annee = classe.Annee; context.SaveChanges(); }
public static int CreateAction(Classes.MSrvType.ActionType ActionType, int TicketId, string ActionComment) { int MSrv_TicketActionId = (int)adpAction.NewId(); DateTime ServerDatetime = Classes.Managers.DataManager.defaultInstance.ServerDateTime; adpAction.Insert(MSrv_TicketActionId, (int)ActionType, TicketId, ServerDatetime, ActionComment, Managers.UserManager.defaultInstance.User.UserId , ServerDatetime, Convert.ToInt16(Managers.UserManager.defaultInstance.User.MSrvDepartmentId)); return MSrv_TicketActionId; }
public ViewRelationProperies_Form(Classes.Relation r) { InitializeComponent(); this.r = r; checkBox1.Checked = r.isFinal(); if (r.isFinal()) textBox1.Text = r.Specialization_Char.ToString(); }
/// <summary> /// <para>Enable the specified <paramref name="messageID"/> for being processed and forwared</para> /// </summary> /// <param name="messageID"></param> public void RegisterEventForMessage(Classes.System.WindowsMessages messageID) { _lock.AcquireWriterLock(Timeout.Infinite); if (!_messageSet.ContainsKey((int)messageID)) _messageSet.Add((int)messageID, 1); else _messageSet[(int)messageID]++; _lock.ReleaseWriterLock(); }
public DividirVenda(Classes.VendaFull vf) { InitializeComponent(); vendas = vf; carregar(); mesas = new List<string>(); rbAberta.Checked = true; lbTItulo.Text += " : "+vf.mesa[vf.mesa.Length-1]; }
public DirectoryBrowser(Classes.Directory directory) : base() { this._logger = LogManager.GetLogger(typeof (DirectoryBrowser)); this.Directory = directory; this._uiNameTextBox.Text = this.Directory.DirectoryName; this._uiPathText.Text = this.Directory.DirectoryPath; this._uiSubFoldersCheckBox.IsChecked = this.Directory.IsIncludeSubdirectories; }
public void Duplicates_Should_Not_Be_Inserted() { var target = new Classes(); target.Add("foo"); target.Insert(0, "foo"); Assert.Equal(new[] { "foo" }, target); }
public static void AllMethodsVirtual(Assembly assembly, Predicate<Class> predicate) { var classes = new Classes(assembly); List<Class> nonTestClasses = classes.WithoutAttribute(typeof(TestFixtureAttribute)).FindAll(obj => !obj.Name.Contains("Test")); var filteredClasses = new Classes(nonTestClasses.FindAll(predicate)); MethodInfos nonVirtuals = filteredClasses.NonVirtuals; BricksCollection<MethodInfo> oughtToBeVirtual = nonVirtuals.Filter(delegate(MethodInfo obj) { return !obj.Name.Contains("NonVirtual"); }); Assert.AreEqual(0, oughtToBeVirtual.Count, oughtToBeVirtual.ToString()); }
public void Duplicates_Should_Not_Be_Inserted_Via_InsertRange() { var target = new Classes(); target.Add("foo"); target.InsertRange(1, new[] { "foo", "bar" }); Assert.Equal(new[] { "foo", "bar" }, target); }
public CustomInputControl(Classes.CustomInput inputLayout, BluetoothHidWriter hidWriter) { this.BackColor = SystemColors.Window; this.Height = inputLayout.Height; this.Width = inputLayout.Width; this.HidWriter = hidWriter; ParseChildren(this, inputLayout.Controls, this.Controls); }
public Player(string charName, Classes className, int level, int ultimatePointsToCast, Animations.Animation standardAnimation, Animations.Animation attackanimation, Animations.Animation deathAnimation) : base(charName, className, level, ultimatePointsToCast, standardAnimation, attackanimation, deathAnimation) { this.HiddenName = this.JosDemon; this.AngelExp = 0; this.DemonExp = 0; LoadSkillHelperClass.AddSkillsToParty(this); }
public void Duplicates_Should_Not_Be_Added_Via_Pseudoclasses() { var target = new Classes(); var ps = (IPseudoClasses)target; ps.Add(":foo"); ps.Add(":foo"); Assert.Equal(new[] { ":foo" }, target); }
public static void AssertAllMethodsAreVirtual(Assembly assembly) { var classes = new Classes(assembly); Classes nonTestClasses = classes.WithoutAttribute(typeof(TestFixtureAttribute)); nonTestClasses = nonTestClasses.Filter(@class => [email protected]("Test")); MethodInfos nonVirtuals = nonTestClasses.NonVirtuals; BricksCollection<MethodInfo> oughtToBeVirtual = nonVirtuals.Filter(obj => !obj.Name.Contains("NonVirtual")); nonVirtuals.ForEach(entity => Console.WriteLine(entity.DeclaringType.FullName + "." + entity.Name)); Assert.AreEqual(0, oughtToBeVirtual.Count); }
public int addApplicant(Classes.XObjs.Applicant x) { string connectionString = this.ConnectXpay(); SqlConnection connection = new SqlConnection(connectionString); SqlCommand command = new SqlCommand("INSERT INTO applicant (xname,address,xemail,xmobile) VALUES ('" + x.xname + "','" + x.address + "','" + x.xemail + "','" + x.xmobile + "') SELECT SCOPE_IDENTITY()", connection); connection.Open(); int succ = Convert.ToInt32(command.ExecuteScalar()); connection.Close(); return succ; }
private static bool IsChannelOrServerFiltering(Channel channel, out Classes.ServerPermissions serverPerms) { if (!PermissionsHandler.PermissionsDict.TryGetValue(channel.Server.Id, out serverPerms)) return false; if (serverPerms.Permissions.FilterInvites) return true; Classes.Permissions perms; return serverPerms.ChannelPermissions.TryGetValue(channel.Id, out perms) && perms.FilterInvites; }
static void Main(string[] args) { List<Person> list = new List<Person>() { new Person(){ID=1,Name="haige"}, new Person(){ID=2,Name="xiaoyao"}, }; Classes cl = new Classes() { ClassName="Tinghua", Persons=list}; var xml = Class2.GetXmlDataDocument(cl); var xmlstring = xml.ToString(); }
//List<Class> classes; void Awake() { // Singleton if (instance) { Destroy (this.gameObject); return; } instance = this; /*classes = new List<Class>(); Stats st = new Stats(); classes.Add(new Class("Warrior","A basic meelee unit, able to wield many different weapons")); classes[0].stats = st; classes.Add(new Class("Mage","A magic user with deep understanding of the arcane arts")); classes.Add(new Class("Archer","A basic ranged unit, able to use bows with high accuracy")); */ /* "Barbarian" "Paladin" "Berserker" "Hoplite" "Gladiator" "Heavy Infantry" "Knight" "Assassin" "Thief" "Ninja" "Swordmaster" "Gambler" "Acrobat" "Fusilier" "Gunman" "Sniper" "Alchemist" "Pyromancer" "Idromancer" "Geomancer" "Druid" "Draconic" "Blood Mage" "Warlock" "Battlemage" "Bishop" "Cleric" "Guard" "Spartan" "Butcher" <-- trait? "" */ }
void OnLevelWasLoaded(int level) { if (this.gameObject == instance) { if (level == 2) { spriteRenderer.enabled = true; GameObject player = Resources.Load("Player/joueurFinal") as GameObject; Debug.Log("onLevelWasLoaded " + playerType); player = Instantiate(player); switch (playerType) { case 0: script = player.AddComponent<class_Heavy>(); Debug.Log("case 0"); break; case 1: script = player.AddComponent<class_Light>(); Debug.Log("case 1"); break; case 2: script = player.AddComponent<class_Tech>(); Debug.Log("case 2"); break; } //player.transform.position = new Vector3(0, 0, 0); /* switch (level) { case 5: e_spawn = GameObject.Find("EnemySpawnMachine").GetComponent<EnemySpawnMachine>(); List<LinearBezier> enemyZones = new List<LinearBezier>(); enemyZones.Add(new LinearBezier(new Vector2(7.0f, 2.5f), new Vector2(7.0f, -2.5f))); enemyZones.Add(new LinearBezier(new Vector2(-4.75f, 4f), new Vector2(-2.3f, 4f))); e_spawn.setMachine(enemyZones); p_spawn = GameObject.Find("PowerupSpawnMachine").GetComponent<PowerupSpawnMachine>(); List<Rect> powerupZones = new List<Rect>(); powerupZones.Add(new Rect(-4.3f, -2.8f, 3f, 4f)); powerupZones.Add(new Rect(1.5f, -1.1f, 3f, 1.2f)); p_spawn.setMachine(powerupZones, 5.0f, 10.0f); break; default: break; }*/ } else if(level == 3) spriteRenderer.enabled = true ; else spriteRenderer.enabled = false ; } }
public static void SelectClass(Classes CurrentClass) { switch (CurrentClass) { case Classes.Spinner: { Speed = 1; Dmg = 15; Agi = 1.5f; Str = 2; Magi = 1; Luck = 1; Arm = 1.5f; Vit = 20; break; } case Classes.Crusher: { Speed = 1; Dmg = 20; Agi = 3; Str = 1; Magi = 1; Luck = 1.5f; Arm = 1f; Vit = 15f; break; } case Classes.Blaster: { Speed = 0.8f; Dmg = 20; Agi = 1; Str = 1; Magi = 3.5f; Luck = 1; Arm = 1; Vit = 10; break; } case Classes.Tank: { Speed = 1; Dmg = 10; Agi = 1; Str = 1; Magi = 1; Luck = 1; Vit = 40; break; } } }
public void Install(IWindsorContainer container, IConfigurationStore store) { container.Register(Classes.FromThisAssembly() .BasedOn <IController>() .LifestyleTransient()); }
//protected virtual TModel Create(int inputs, TKernel kernel) //{ // return SupportVectorLearningHelper.Create<TModel, TInput, TKernel>(inputs, kernel); //} /// <summary> /// Learns a model that can map the given inputs to the given outputs. /// </summary> /// <param name="x">The model inputs.</param> /// <param name="y">The desired outputs associated with each <paramref name="x">inputs</paramref>.</param> /// <param name="weights">The weight of importance for each input-output pair (if supported by the learning algorithm).</param> /// <returns> /// A model that has learned how to produce <paramref name="y" /> given <paramref name="x" />. /// </returns> public override TModel Learn(TInput[] x, bool[] y, double[] weights = null) { Accord.MachineLearning.Tools.CheckArgs(x, y, weights, () => { bool initialized = false; if (kernel == null) { kernel = SupportVectorLearningHelper.CreateKernel <TKernel, TInput>(x); initialized = true; } if (!initialized) { if (useKernelEstimation) { kernel = SupportVectorLearningHelper.EstimateKernel(kernel, x); } else { if (!hasKernelBeenSet) { Trace.TraceWarning("The Kernel property has not been set and the UseKernelEstimation property is set to false. Please" + " make sure that the default parameters of the kernel are suitable for your application, otherwise the learning" + " will result in a model with very poor performance."); } } } if (Model == null) { Model = Create(SupportVectorLearningHelper.GetNumberOfInputs(kernel, x), kernel); } Model.Kernel = kernel; return(Model); }, onlyBinary: true); // Count class prevalence int positives, negatives; Classes.GetRatio(y, out positives, out negatives); // If all examples are positive or negative, terminate // learning early by directly setting the threshold. try { if (positives == 0 || negatives == 0) { Model.SupportVectors = new TInput[0]; Model.Weights = new double[0]; Model.Threshold = (positives == 0) ? -1 : +1; return(Model); } // Initialization heuristics if (useComplexityHeuristic) { complexity = kernel.EstimateComplexity(x); } if (useClassLabelProportion) { WeightRatio = positives / (double)negatives; } // Create per sample complexity Cpositive = complexity * positiveWeight; Cnegative = complexity * negativeWeight; Inputs = x; C = new double[y.Length]; for (int i = 0; i < y.Length; i++) { C[i] = y[i] ? Cpositive : Cnegative; } Outputs = new int[y.Length]; for (int i = 0; i < y.Length; i++) { Outputs[i] = y[i] ? 1 : -1; } if (weights != null) { for (int i = 0; i < C.Length; i++) { C[i] *= weights[i]; } } InnerRun(); SupportVectorLearningHelper.CheckOutput(Model); return(Model); } finally { if (machine != null) { // TODO: This block is only necessary to offer compatibility // to code written using previous versions of the framework, // and should be removed after a few releases. machine.SupportVectors = Model.SupportVectors; machine.Weights = Model.Weights; machine.Threshold = Model.Threshold; machine.Kernel = Model.Kernel; machine.IsProbabilistic = Model.IsProbabilistic; } } }
/// <summary> /// Returns the static fields of the <c>elementClass</c> /// marked with the specified annotation. /// </summary> /// <typeparam name="T"> /// The annotation class. /// </typeparam> /// <returns> /// The static fields marked with the specified annotation. /// </returns> private IEnumerable <FieldInfo> GetStaticFields <T>() where T : Attribute => Classes.GetStaticFields <T>(Class);
public void Install(IWindsorContainer container, IConfigurationStore store) { container.Register(Classes.FromAssemblyContaining <FormulierenController>().BasedOn <IController>().LifestylePerWebRequest()); }
public void Install(IWindsorContainer container, IConfigurationStore store) { container.Register(Classes.FromThisAssembly() .Where(type => type.Name.EndsWith("View")) .Configure(c => c.LifeStyle.Is(LifestyleType.Singleton))); }
public DefaultHandlerInstaller(string directoryToSearch) : this(Classes.FromAssemblyInDirectory(new AssemblyFilter(directoryToSearch))) { }
public SampleGrabber(Classes classes) { _class = classes; }
public static IWindsorContainer AddCommandsAndProcesses(this IWindsorContainer container, Assembly assembly) { container.Register(Classes.FromAssembly(assembly).BasedOn <ICommand>().WithServiceAllInterfaces().LifestyleTransient()); return(container); }
/// <summary> /// Returns the instance methods of the <c>elementClass</c> marked with /// the specified annotation. /// </summary> /// <typeparam name="T"> /// The annotation class. /// </typeparam> /// <returns> /// The instance methods marked with the specified annotation. /// </returns> private IEnumerable <MethodInfo> GetInstanceMethods <T>() where T : Attribute => Classes.GetInstanceMethods <T>(Class);
/// <summary> /// Performs the installation in the <see cref="T:Castle.Windsor.IWindsorContainer"/>. /// </summary> /// <param name="container">The container.</param><param name="store">The configuration store.</param> public void Install(IWindsorContainer container, IConfigurationStore store) { container.Register(Classes.FromAssembly(typeof(PutBalanceRequestValidator).Assembly) .BasedOn(typeof(AbstractValidator <>)) .WithServiceFirstInterface().LifestylePerWebRequest()); }
public bool HasBoundOperations(string fullNamespace) { return(Classes.Any(c => c.Methods.Any())); }
public void Install(IWindsorContainer container, IConfigurationStore store) { container.AddFacility <TypedFactoryFacility>(); container.Register( Classes .FromThisAssembly() .BasedOn(typeof(ISettingsRepository <>)) .WithServiceAllInterfaces() .LifestyleTransient() ); container.Register( Component .For <IMT5Api>() .ImplementedBy <MT5Api>() .LifestyleTransient() ); container.Register( Component .For <ITradingWatchdog>() .ImplementedBy <Watchdog.TradingWatchdog>() .LifestyleTransient() ); container.Register( Component .For <ITradesMonitor>() .ImplementedBy <TradesMonitor>() .LifestyleSingleton() ); container.Register( Component .For <ITradeValidator>() .ImplementedBy <TradeValidator>() .LifestyleSingleton() ); container.Register( Component .For <ITradingServerListener>() .ImplementedBy <TradingServerListener>() .LifestyleTransient() ); container.Register( Component .For <ITradingServerListenerFactory>() .AsFactory() ); container.Register( Component .For <ILogger>() .ImplementedBy <FileLogger>() .LifestyleSingleton() ); container.Register( Component .For <ILogEntryFormatter>() .ImplementedBy <JsonLogEntryFormatter>() .LifestyleSingleton() ); }
/// <summary> /// Learns a model that can map the given inputs to the given outputs. /// </summary> /// /// <param name="x">The model inputs.</param> /// <param name="y">The desired outputs associated with each <paramref name="x">inputs</paramref>.</param> /// <param name="weights">The weight of importance for each input-output pair (if supported by the learning algorithm).</param> /// /// <returns>A model that has learned how to produce <paramref name="y"/> given <paramref name="x"/>.</returns> /// public Boost <TModel> Learn(double[][] x, bool[] y, double[] weights = null) { return(Learn(x, Classes.ToZeroOne(y), weights)); }
public Resize(Classes classes) { _class = classes; }
public void Install(IWindsorContainer container, IConfigurationStore store) { container.Register(Component.For <IWindsorContainer>().Instance(container)); container.AddFacility <TypedFactoryFacility>(); container.Register(Component.For <ITypedFactoryComponentSelector>().ImplementedBy <CustomTypeFactoryComponentSelector>()); //Configure logging ILoggingConfiguration loggingConfiguration = new LoggingConfiguration(); log4net.GlobalContext.Properties["LogFile"] = Path.Combine(loggingConfiguration.LogDirectoryPath, loggingConfiguration.LogFileName); log4net.Config.XmlConfigurator.ConfigureAndWatch(new FileInfo(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile)); var applicationRootNameSpace = typeof(Program).Namespace; container.AddFacility <LoggingFacility>(f => f.UseLog4Net().ConfiguredExternally()); container.Kernel.Register(Component.For <ILog>().Instance(LogManager.GetLogger(applicationRootNameSpace))); //Default logger container.Kernel.Resolver.AddSubResolver(new LoggerSubDependencyResolver()); //Enable injection of class specific loggers //Manual registrations container.Register(Component.For <MainWindow>().Activator <StrictComponentActivator>()); container.Register(Component.For <MainView>().Activator <StrictComponentActivator>()); container.Register(Component.For <MainViewModel>().Activator <StrictComponentActivator>()); //Factory registrations example: //container.Register(Component.For<ITeamProviderFactory>().AsFactory()); //container.Register( // Component.For<ITeamProvider>() // .ImplementedBy<CsvTeamProvider>() // .Named("CsvTeamProvider") // .LifeStyle.Transient); //container.Register( // Component.For<ITeamProvider>() // .ImplementedBy<SqlTeamProvider>() // .Named("SqlTeamProvider") // .LifeStyle.Transient); container.Register(Component.For <IInvocationLogStringBuilder>().ImplementedBy <InvocationLogStringBuilder>().LifestyleSingleton()); container.Register(Component.For <ILogFactory>().ImplementedBy <LogFactory>().LifestyleSingleton()); /////////////////////////////////////////////////////////////////// //Automatic registrations /////////////////////////////////////////////////////////////////// // // Register all interceptors // container.Register(Classes.FromAssemblyInThisApplication() .Pick().If(type => type.Name.EndsWith("Aspect")).LifestyleSingleton()); // // Register all command providers and attach logging interceptor // const string libraryRootNameSpace = "Script.Install.Tools.Library"; container.Register(Classes.FromAssemblyContaining <CommandProvider>() .InNamespace(libraryRootNameSpace, true) .If(type => type.Is <CommandProvider>()) .Configure(registration => registration.Interceptors(new[] { typeof(DebugLogAspect) })) .WithService.DefaultInterfaces().LifestyleTransient() ); // // Register all command definitions // container.Register( Classes.FromAssemblyInThisApplication() .BasedOn <CommandDefinition>() .WithServiceBase() ); // // Register all singletons found in the library // container.Register(Classes.FromAssemblyContaining <CommandDefinition>() .InNamespace(libraryRootNameSpace, true) .If(type => Attribute.IsDefined(type, typeof(SingletonAttribute))) .WithService.DefaultInterfaces().LifestyleSingleton()); // // Register all transients found in the library // container.Register(Classes.FromAssemblyContaining <CommandDefinition>() .InNamespace(libraryRootNameSpace, true) .WithService.DefaultInterfaces().LifestyleTransient()); IApplicationInfo applicationInfo = new ApplicationInfo(); container.Register(Component.For <IApplicationInfo>().Instance(applicationInfo).LifestyleSingleton()); }
//Api public async void Get_Contacts_APi() { try { if (!IMethods.CheckConnectivity()) { RunOnUiThread(() => { swipeRefreshLayout.Refreshing = false; }); Toast.MakeText(this, GetString(Resource.String.Lbl_Error_check_internet_connection), ToastLength.Short) .Show(); } else { var lastIdUser = CallAdapter.mCallUserContacts?.LastOrDefault()?.UserId ?? "0"; var(api_status, respond) = await API_Request.Get_users_friends_Async(lastIdUser); if (api_status == 200) { if (respond is Classes.UserContacts result) { RunOnUiThread(() => { if (result.Users.Count <= 0) { } else if (result.Users.Count > 0) { var listNew = result.Users?.Where(c => !CallAdapter.mCallUserContacts.Select(fc => fc.UserId).Contains(c.UserId)).ToList(); if (listNew.Count > 0) { Classes.AddRange(CallAdapter.mCallUserContacts, listNew); var lastCountItem = CallAdapter.ItemCount; CallAdapter.NotifyItemRangeInserted(lastCountItem, listNew.Count); CallAdapter.BindEnd(); CallAdapter.NotifyItemChanged(0); //Insert Or Update All data UsersContact to database var dbDatabase = new SqLiteDatabase(); dbDatabase.Insert_Or_Replace_MyContactTable(CallAdapter.mCallUserContacts); dbDatabase.Dispose(); } if (swipeRefreshLayout != null) { swipeRefreshLayout.Refreshing = false; } } }); } } else if (api_status == 400) { if (respond is ErrorObject error) { var errortext = error._errors.Error_text; if (errortext.Contains("Invalid or expired access_token")) { API_Request.Logout(this); } } } else if (api_status == 404) { var error = respond.ToString(); } } //Show Empty Page >> //=============================================================== RunOnUiThread(() => { if (CallAdapter.mCallUserContacts?.Count > 0) { Calluser_Empty.Visibility = ViewStates.Gone; CalluserRecylerView.Visibility = ViewStates.Visible; } else { Calluser_Empty.Visibility = ViewStates.Visible; CalluserRecylerView.Visibility = ViewStates.Gone; } swipeRefreshLayout.Refreshing = false; //Set Event Scroll if (OnMainScrolEvent == null) { var xamarinRecyclerViewOnScrollListener = new XamarinRecyclerViewOnScrollListener(ContactsLayoutManager); OnMainScrolEvent = xamarinRecyclerViewOnScrollListener; OnMainScrolEvent.LoadMoreEvent += MyContact_OnScroll_OnLoadMoreEvent; CalluserRecylerView.AddOnScrollListener(OnMainScrolEvent); CalluserRecylerView.AddOnScrollListener(new ScrollDownDetector()); } else { OnMainScrolEvent.IsLoading = false; } }); } catch (Exception e) { Console.WriteLine(e); Get_Contacts_APi(); } }
public ICollection <Model.IElement> LoadSubmodels() => Classes.Cast <Model.IElement>().ToList();
public GraphMap(Classes classes) { _class = classes; }
//Get Photo API public async void Get_AlbumUser_Api(string offset = "") { try { if (!IMethods.CheckConnectivity()) { RunOnUiThread(() => { swipeRefreshLayout.Refreshing = false; }); Toast.MakeText(this, GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short) .Show(); ImagesRecylerView.Visibility = ViewStates.Visible; photos_Empty.Visibility = ViewStates.Gone; } else { var(Api_status, Respond) = await Client.Album.Get_User_Albums(S_UserId, "35", offset); if (Api_status == 200) { if (Respond is Get_User_Albums_Object result) { RunOnUiThread(() => { if (result.albums.Count <= 0) { if (swipeRefreshLayout != null) { swipeRefreshLayout.Refreshing = false; } } else if (result.albums.Count > 0) { //Bring new groups var listNew = result.albums.Where(c => !photosAdapter.mMyAlbumsList.Select(fc => fc.group_id).Contains(c.group_id)) .ToList(); if (listNew.Count > 0) { //Results differ Classes.AddRange(photosAdapter.mMyAlbumsList, listNew); photosAdapter.BindEnd(); } else { photosAdapter.mMyAlbumsList = new ObservableCollection <Get_User_Albums_Object.Album>(result.albums); photosAdapter.BindEnd(); } } }); } } else if (Api_status == 400) { if (Respond is Error_Object error) { var errorText = error._errors.Error_text; //Toast.MakeText(this, errortext, ToastLength.Short).Show(); if (errorText.Contains("Invalid or expired access_token")) { API_Request.Logout(this); } } } else if (Api_status == 404) { var error = Respond.ToString(); //Toast.MakeText(this, error, ToastLength.Short).Show(); } } //Show Empty Page >> //=============================================================== RunOnUiThread(() => { if (photosAdapter.mMyAlbumsList.Count > 0) { ImagesRecylerView.Visibility = ViewStates.Visible; photos_Empty.Visibility = ViewStates.Gone; } else { ImagesRecylerView.Visibility = ViewStates.Gone; photos_Empty.Visibility = ViewStates.Visible; } swipeRefreshLayout.Refreshing = false; //Set Event Scroll if (OnMainScrolEvent == null) { var xamarinRecyclerViewOnScrollListener = new XamarinRecyclerViewOnScrollListener(mLayoutManager, swipeRefreshLayout); OnMainScrolEvent = xamarinRecyclerViewOnScrollListener; OnMainScrolEvent.LoadMoreEvent += MyAlbums_OnScroll_OnLoadMoreEvent; ImagesRecylerView.AddOnScrollListener(OnMainScrolEvent); ImagesRecylerView.AddOnScrollListener(new ScrollDownDetector()); } else { OnMainScrolEvent.IsLoading = false; } }); } catch (Exception e) { Crashes.TrackError(e); Get_AlbumUser_Api(offset); } }
/// <summary> /// Returns the static methods of the <c>elementClass</c> marked with /// the specified annotation. /// </summary> /// <typeparam name="T"> /// The annotation class. /// </typeparam> /// <returns> /// The static methods marked with the specified annotation. /// </returns> private IEnumerable <MethodInfo> GetStaticMethods <T>() where T : Attribute => Classes.GetStaticMethods <T>(Class);
public SnooperPOPWindsorInstaller() : base(Classes.FromAssemblyContaining <SnooperPOPWindsorInstaller>()) { }
public static void SetClasses(IStyledElement element, Classes value) { element.SetValue(ClassesProperty, value); OnClassesChanged(element, value); }
void AddClass(IClass c) { Classes.Add(c); }
/// <summary> /// Returns the instance fields of the <c>elementClass</c> /// marked with the specified annotation. /// </summary> /// <typeparam name="T"> /// The annotation class. /// </typeparam> /// <returns> /// The instance fields marked with the specified annotation. /// </returns> private IEnumerable <FieldInfo> GetInstanceFields <T>() where T : Attribute => Classes.GetInstanceFields <T>(Class);
/// <summary> /// Remove css classes from the VNode. /// </summary> /// <param name="classes"></param> public void RemoveClasses(params string[] classes) { _attributes["class"] = string.Join(" ", Classes.Except(classes)); }
public Guild(Classes l) { leader = l; members = new List <Classes>(); }
public ActionResult Detalhes(int id) { Classes classe = _classeService.ObterClassePorId(id); return(View(classe)); }
void IWindsorInstaller.Install(IWindsorContainer container, IConfigurationStore store) { container.Register(Classes.FromAssemblyContaining <AddOperationStrategy>().BasedOn <IOperationStrategy>().WithService.Self()); container.Register(Classes.FromAssemblyContaining <AddOperationStrategy>().BasedOn <IOperationStrategySpecification>().WithServiceAllInterfaces()); }
public ActionResult Edit(int id, Classes classe) { TempData["Mensagem"] = _home.AlertaNotificacao(_classeService.Editar(id, classe)); return(RedirectToAction("Index")); }
public Init(Classes classes) { _class = classes; }