public SchemeCreator(Point Origin, MaterialForm BaseFormToOverlay) { BackBrush = Brushes.Magenta; SetStyle(ControlStyles.SupportsTransparentBackColor, true); FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; CurrentHoveredPath = new GraphicsPath(); //set the backcolor and transparencykey on same color. this.BackColor = Color.Magenta; this.TransparencyKey = Color.Magenta; InitializeComponent(); FillBrush = new SolidBrush(MaterialSkinManager.Instance.GetApplicationBackgroundColor()); _Origin = Origin; _BaseForm = BaseFormToOverlay; objAnimationManager = new AnimationManager() { Increment = 0.015, AnimationType = AnimationType.EaseInOut }; DoubleBuffered = true; objAnimationManager.OnAnimationProgress += sender => Invalidate(); objAnimationManager.OnAnimationFinished += objAnimationManager_OnAnimationFinished; Visible = false; _ActiveKey = _PrimaryKey; _Primary = Primary.Indigo500; _PrimaryDark = Primary.Indigo700; _PrimaryLight = Primary.Indigo100; _Accent = Accent.Pink200; _Text = TextShade.WHITE; BaseFormToOverlay.LocationChanged += BaseFormToOverlay_LocationChanged; initColorHints(); Size = _BaseForm.Size; Location = _BaseForm.Location; MouseUp += SchemeCreator_MouseUp; }
public PlayContext() { finalState = new Final(); primaryState = new Primary(); professionState = new Professional(); secondState = new Secondary(); }
public static void SaveApp(Primary parent) { parent.ActiveControl = null; WriteAppListXml(); WriteAppSettingsXml(); }
public void InvokePrimary() { if (Primary != null) { Primary.Invoke(); } }
static private void FormKeyboardScript(Primary parent, T7EJumplistItem jumplistItem, string fileName) { string templateText = Common.Template_KBD; string tempAppPath = parent.CurrentAppPath; templateText = templateText.Replace("{Path_AppData}", Common.Path_AppData); templateText = templateText.Replace("{AppId}", parent.CurrentAppId); templateText = templateText.Replace("{AppName}", parent.CurrentAppName); templateText = templateText.Replace("{AppPath}", tempAppPath); templateText = templateText.Replace("{AppProcessName}", Path.GetFileName(parent.CurrentAppPath).ToLower()); templateText = templateText.Replace("{AppWindowClassName}", parent.CurrentAppWindowClassName); templateText = templateText.Replace("{Keystroke}", jumplistItem.TaskKBDString); templateText = templateText.Replace("{KBDStartNewProcess}", Convert.ToInt32(jumplistItem.TaskKBDNew).ToString()); templateText = templateText.Replace("{KBDIgnoreAbsent}", Convert.ToInt32(jumplistItem.TaskKBDIgnoreAbsent).ToString()); templateText = templateText.Replace("{KBDIgnoreCurrent}", Convert.ToInt32(jumplistItem.TaskKBDIgnoreCurrent).ToString()); if (jumplistItem.TaskKBDMinimizeAfterward) { templateText = templateText.Replace("{KBDSendBackground}", 2.ToString()); } else { templateText = templateText.Replace("{KBDSendBackground}", Convert.ToInt32(jumplistItem.TaskKBDSendInBackground).ToString()); } TextWriter scriptWriter = new StreamWriter(fileName); scriptWriter.Write(templateText); scriptWriter.Dispose(); }
/// <summary> /// extracts value using first-in first out approach /// </summary> /// <returns> value removed</returns> public Node Dequeue1() { if (Primary.Top == null) /// check to see if stack is empty { return(null); } else if (Primary.Top.Next == null) /// check to see if single stack { Node newNode = Primary.Pop(); return(newNode); } else { while (Primary.Top.Next != null) ///pop from primary stack into secondary stack { Node newNode = Primary.Pop(); Secondary.Push(newNode.Value); } Node temp = Secondary.Top; while (Secondary.Top != null) ///pop from secondary stack onto primary stack { Primary.Top = temp.Next; temp.Next = null; Node newNode = Secondary.Pop(); Primary.Push(newNode.Value); } } return(Secondary.Pop()); }
private void HandleSavePayorCoverageCompleted(ReceivedResponses receivedResponses) { var response = receivedResponses.Get <DtoResponse <PayorCoverageCacheDto> >(); if (response.DataTransferObject.HasErrors) { var errorMessageBuilder = new StringBuilder(); foreach (var dataErrorInfo in response.DataTransferObject.DataErrorInfoCollection) { errorMessageBuilder.Append(dataErrorInfo.Message + "\n"); } _userDialogService.ShowDialog(errorMessageBuilder.ToString(), "Error Deleting Payor", UserDialogServiceOptions.Ok); } else { var payorToDelete = Primary.FirstOrDefault(pc => pc.Key == response.DataTransferObject.Key); if (payorToDelete != null) { Primary.Remove(payorToDelete); } else if ((payorToDelete = Secondary.FirstOrDefault(pc => pc.Key == response.DataTransferObject.Key)) != null) { Secondary.Remove(payorToDelete); } else if ((payorToDelete = Tertiary.FirstOrDefault(pc => pc.Key == response.DataTransferObject.Key)) != null) { Tertiary.Remove(payorToDelete); } else if ((payorToDelete = PayorCoverageHistory.FirstOrDefault(pc => pc.Key == response.DataTransferObject.Key)) != null) { PayorCoverageHistory.Remove(payorToDelete); } } IsLoading = false; }
public void Change(Card c) { primary = c.primary; secondary = c.secondary; BackgroundIni(); PrimaryImageIni(); }
public void Awake() { #region survivor SurvivorAPI.SurvivorCatalogReady += delegate(object s, EventArgs e) { { var bandit = BodyCatalog.FindBodyPrefab("BanditBody"); SurvivorDef item = new SurvivorDef { bodyPrefab = bandit, descriptionToken = "test", displayPrefab = Resources.Load <GameObject>("prefabs/characterbodies/banditbody").GetComponent <ModelLocator>().modelTransform.gameObject, primaryColor = new Color(0.87890625f, 0.662745098f, 0.3725490196f), unlockableName = "", survivorIndex = SurvivorIndex.Count }; #region skills #if skills Primary.SetPrimary(bandit); PrepSecondary.SetSecondary(bandit); Banditspecial(bandit); EntityStates.Bandit.Utility.SetUtility(bandit); #endif #endregion skills SkillManagement.banditskilldescriptions(bandit); SurvivorAPI.AddSurvivor(item); } }; #endregion #region timer #if timer Timer.Init(); #endif #endregion }
protected override string GetCreateTableSql() { StringBuilder builder = new StringBuilder($"CREATE TABLE IF NOT EXISTS `{Schema.Database }`.`{Schema.TableName}` ("); string columNames = string.Join(", ", Columns.Select(p => $"`{p.Name}` {ConvertToDbType(p.DataType.ToLower())} {GetAutoIncrementString(p.Name)}")); builder.Append(columNames.Substring(0, columNames.Length)); foreach (var index in Indexs) { string name = string.Join("_", index.Select(c => c)); string indexColumNames = string.Join(", ", index.Select(c => $"`{c}`")); builder.Append($", KEY `index_{name}` ({indexColumNames.Substring(0, indexColumNames.Length)})"); } foreach (var unique in Uniques) { string name = string.Join("_", unique.Select(c => c)); string uniqueColumNames = string.Join(", ", unique.Select(c => $"`{c}`")); builder.Append($", UNIQUE KEY `unique_{name}` ({uniqueColumNames.Substring(0, uniqueColumNames.Length)})"); } string primaryColumNames = string.Join(", ", Primary.Select(c => $"`{c}`")); builder.Append($", PRIMARY KEY ({primaryColumNames.Substring(0, primaryColumNames.Length)})"); builder.Append(") ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8"); string sql = builder.ToString(); Logger.Info(sql); return(sql); }
public static void BuildGraphFromJISONJSON(Dictionary <string, object> JISONJsonParseResult) { Dictionary <string, object> Declarations = (Dictionary <string, object>)JISONJsonParseResult["Declarations"]; if (!Declarations.ContainsKey("Type") || Declarations["Type"].ToString().ToLower().Equals("insurance")) { _Contract contract = new Primary(Declarations["Name"].ToString()); // Rebuild contract subject _Schedule schedule = new Schedule(Declarations["_Schedule"].ToString().Trim()); HashSet <ICauseOfLoss> ContractSubjectCausesOfLoss = new HashSet <ICauseOfLoss>(); string[] causes_of_loss = Declarations["CauseOfLoss"].ToString().Trim().Split(','); foreach (string cause_of_loss in causes_of_loss) { ContractSubjectCausesOfLoss.Add(new Peril(cause_of_loss.Trim())); } string[] _coverages = Declarations["CoverageType"].ToString().Trim().Split(','); HashSet <string> coverages = new HashSet <string>(); for (int i = 0; i < _coverages.Length; i++) { coverages.Add(_coverages[i].Trim()); } contract.Subject = new Subject(schedule, ContractSubjectCausesOfLoss, coverages, false); } }
public CacheCapacity(Primary primary) { ////TODO: the default value should be changed after designing cache schedule algorithm this.Size = 0; this.Count = 0; this.Primary = primary; }
public void Initialize(string itemName, int propStat, int primary, int primaryVal, int vita, ItemSlot itemSlot, bool dis, bool upg, Sprite icon) { this.itemName = itemName; name = itemName; propertyStat = propStat; primaryStat = primaryVal; if (primary == 1) { stat = Primary.Strenght; } else if (primary == 2) { stat = Primary.Agilty; } else if (primary == 3) { stat = Primary.Intellect; } vitality = vita; slot = itemSlot; disenchantable = dis; upgradable = upg; SetRarity(); this.GetComponent <Image>().sprite = icon; }
public IReadOnlyList <TItem> GetOrAdd(TKey key, Func <TKey, IEnumerable <TItem> > getFunc) { int index = Primary.GetOrAdd(key, k => { var rawList = getFunc(k); lock (Primary) { int[] itemListByIndex = rawList.Select(item => { if (!ItemDict.TryGetValue(item, out int itemIndex)) { itemIndex = ItemList.Count; ItemList.Add(item); ItemDict[item] = itemIndex; } return(itemIndex); }).ToArray(); var intArray = new IntArray(itemListByIndex); if (!ListDict.TryGetValue(intArray, out int listIndex)) { lock (ListList) { listIndex = ListList.Count; ListList.Add(itemListByIndex.Select(ii => ItemList[ii]).ToArray()); } ListDict[intArray] = listIndex; } return(listIndex); }
public void LoadAccounts(Primary primary) { if (!File.Exists(this.UserSettings.AccountsFile)) { try { Directory.CreateDirectory(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal) + "/My Games/" + this.UserSettings.Config.ModName)); XmlDocument xmlDocument = new XmlDocument(); XmlComment comment = xmlDocument.CreateComment("Launcher Accounts File, do not edit unless you know what you're doing."); xmlDocument.AppendChild((XmlNode)comment); XmlNode element = (XmlNode)xmlDocument.CreateElement("AccountsList"); xmlDocument.AppendChild(element); xmlDocument.Save(this.UserSettings.AccountsFile); } catch (Exception ex) { ExceptionHandler.Throw(ExceptionCode.C03, ex.Message, primary); } } try { XmlSerializer serializer = new XmlSerializer(typeof(AccountList)); string xml = File.ReadAllText(this.UserSettings.AccountsFile); xml = xml.Replace("True", "true"); xml = xml.Replace("False", "false"); xml = xml.Replace("favorite=\"Yes\"", "favorite=\"true\""); xml = xml.Replace("favorite=\"No\"", "favorite=\"false\""); xml = xml.Replace("favorite=\"yes\"", "favorite=\"true\""); xml = xml.Replace("favorite=\"no\"", "favorite=\"false\""); using (TextReader reader = new StringReader(xml)) { this.UserSettings.AccountList = (AccountList)serializer.Deserialize(reader); reader.Dispose(); } for (var index = 0; index < this.UserSettings.AccountList.Accounts.Count; index++) { Account account = this.UserSettings.AccountList.Accounts[index]; if (string.IsNullOrEmpty(account.Category)) { account.Category = "None"; } if (string.IsNullOrEmpty(account.Code) || string.IsNullOrEmpty(account.Name) || string.IsNullOrEmpty(account.Signature) || string.IsNullOrEmpty(account.Description)) { this.UserSettings.AccountList.Accounts.RemoveAt(index); } else { this.UserSettings.AccountList.Accounts[index] = account; } } } catch (Exception ex) { ExceptionHandler.Throw(ExceptionCode.C04, ex.Message, primary); } }
public ManageForm(Primary parent, ManageFormMode formMode) { InitializeComponent(); this.Icon = Primary.PrimaryIcon; FormMode = formMode; PrimaryParent = parent; if (formMode == ManageFormMode.OpenApp) { // This used to do something cool, but I merged the modes since then. // Now all this does is change the label. Text = "Select a program"; ManageLabel.Text = "Select a program to open."; } ManageListView.SmallImageList = ManageListViewImageList; // Populate ManageListBox with programs PopulateManageListBox(); UpdateButtonStatus(); if (ManageListView.Items.Count > 0) { ManageListView.Items[0].Selected = true; } }
void OnTriggerEnter(Collider other) { Debug.Log("trigger enter"); if (other.gameObject.CompareTag("hole")) { Primary pr = (GameObject.Find("primary")).GetComponent <Primary>(); if (gameObject.CompareTag("playerball")) { if (pr.player == 1) { pr.player1score--; } else if (pr.player == 2) { pr.player2score--; } } else if (gameObject.CompareTag("target")) { if (pr.player == 1) { pr.player1score++; pr.player = 1; } else if (pr.player == 2) { pr.player2score++; pr.player = 2; } } Destroy(gameObject); } }
private void LoadTheme(Themes theme) { Primary p = (Primary)Enum.Parse(typeof(Primary), theme.Primary.ToString()); Primary dp = (Primary)Enum.Parse(typeof(Primary), theme.DarkPrimary.ToString()); Primary lp = (Primary)Enum.Parse(typeof(Primary), theme.LightPrimary.ToString()); Accent acc = (Accent)Enum.Parse(typeof(Accent), theme.Accent.ToString()); TextShade ts = (TextShade)Enum.Parse(typeof(TextShade), theme.TextShade.ToString()); cbPrimary.SelectedIndex = Array.IndexOf(Enum.GetValues(p.GetType()), p); cbDarkPrimary.SelectedIndex = Array.IndexOf(Enum.GetValues(dp.GetType()), dp); cbLightPrimary.SelectedIndex = Array.IndexOf(Enum.GetValues(lp.GetType()), lp); cbAccent.SelectedIndex = Array.IndexOf(Enum.GetValues(acc.GetType()), acc); cbTextShade.SelectedIndex = Array.IndexOf(Enum.GetValues(ts.GetType()), ts); if (MaterialSkinManager.Instance.Theme != (MaterialSkinManager.Themes)theme.Mode) //changing theme to the same theme is still expensive { MaterialSkinManager.Instance.Theme = (MaterialSkinManager.Themes)theme.Mode; } currentSelectedTheme = theme; Settings set = BLLocalDatabase.Setting.Settings; set.CurrentTheme = theme.Id; BLLocalDatabase.Setting.UpdateSettings(set); GC.Collect(); }
/// <summary> /// In HTML konvertieren /// </summary> /// <param name="context">Der Kontext, indem das Steuerelement dargestellt wird</param> /// <returns>Das Control als HTML</returns> public override IHtmlNode Render(RenderContext context) { if (Header.Content.Count == 0 && Preferences.Count == 0 && Primary.Count == 0 && Secondary.Count == 0) { return(null); } var elements = new List <IHtmlNode> { Header.Render(context) }; elements.AddRange(Preferences.Select(x => x.Render(context))); elements.AddRange(Primary.Select(x => x.Render(context))); elements.AddRange(Secondary.Select(x => x.Render(context))); return(new HtmlElementTextContentDiv(elements) { ID = ID, Class = Css.Concatenate("footer", GetClasses()), Style = Style.Concatenate("display: block;", GetStyles()), Role = Role }); }
/// <summary> /// returns the first of specified type in the queue /// if none of specified type, returns null /// if invalid type, returns null and reports invalid on console /// </summary> /// <param name="pref"> type of animal requested </param> /// <returns> found animal or null </returns> public Animal Dequeue(string pref) { Animal temp = null; if (pref == "") { return(Primary.Dequeue()); } if (pref != "dog" && pref != "cat") { Console.WriteLine($"This shelter doesn't house {pref}s."); return(temp); } temp = Primary.Dequeue(); while (Primary.Front != null && temp.Species != pref) { Helper.Enqueue(temp); temp = Primary.Dequeue(); } while (Primary.Front != null) { Helper.Enqueue(Primary.Dequeue()); } Queue hold; hold = Primary; Primary = Helper; Helper = hold; return(temp); }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (Id != null) { hashCode = hashCode * 59 + Id.GetHashCode(); } if (ResourceState != null) { hashCode = hashCode * 59 + ResourceState.GetHashCode(); } if (Primary != null) { hashCode = hashCode * 59 + Primary.GetHashCode(); } if (Name != null) { hashCode = hashCode * 59 + Name.GetHashCode(); } if (Distance != null) { hashCode = hashCode * 59 + Distance.GetHashCode(); } return(hashCode); } }
public Dictionary <string, string> SendSMS(string To, string Body) { Dictionary <string, string> resp = null; try { // resp = this[2].SendSMS(To, Body); resp = Primary.SendSMS(To, Body); Console.WriteLine("SMS Send With Primary"); } catch { try { if (FallBack != null) { resp = FallBack.SendSMS(To, Body); Console.WriteLine("SMS Send With Secondary"); } } catch (Exception ex) { Console.WriteLine("SMS Sending Failed: " + ex.StackTrace); } } return(resp); }
public Animal Dequeue(string pref) { Animal temp = null; if (pref == "") { return(Primary.Dequeue()); } if (pref != "dog" && pref != "cat") { Console.WriteLine("This animal does not exist"); return(temp); } temp = Primary.Dequeue(); // Checking to see if there is a match, if not send to secondary queue // If the primary has anything left in it after finding a match go ahead and send the rest to the second queue while (Primary.Front != null && temp.Species != pref) { Secondary.Enqueue(temp); temp = Primary.Dequeue(); } while (Primary.Front != null) { Secondary.Enqueue(Primary.Dequeue()); } Queue temp2; temp2 = Primary; Primary = Secondary; Secondary = temp2; return(temp); }
public void SetAllStats(int[] primary, int[] secondary, int[] defense, int[] element, int[] armorType, int[] weaponType) { Primary.SetAll(primary); Secondary.SetAll(secondary); Defense.SetAll(defense); ElementDefense.SetAll(element); ArmorTypes.SetAll(armorType); WeaponTypes.SetAll(weaponType); Major.SetAll ( new int[] { ( Secondary.Stats[SecondaryFlag.Vitality].Value * Primary.Stats[PrimaryFlag.Con].Value * UnitLevel.Value ), ( Primary.Stats[PrimaryFlag.Str].Value + Primary.Stats[PrimaryFlag.Dex].Value + Primary.Stats[PrimaryFlag.Con].Value + PowerBonus() ), ( Primary.Stats[PrimaryFlag.Int].Value + Primary.Stats[PrimaryFlag.Wis].Value + Primary.Stats[PrimaryFlag.Cha].Value + MagicBonus() ) } ); }
public AttackStateEnum Reload() { // check if we have a primary weapon if (Primary == null) { return(AttackStateEnum.None); } if (!Primary.HasAmmo()) { return(AttackStateEnum.NoRounds); } // check if there are rounds if (Primary.RoundsInClip(out int rounds)) { return(AttackStateEnum.FullyLoaded); } bool reload = Primary.Reload(); if (reload) { return(AttackStateEnum.Reloaded); } else { throw new Exception("Failed to reload"); } }
public void UpgradeSword(Primary newSwordLevel) { if (newSwordLevel > SwordLevel) { SwordLevel = newSwordLevel; } }
// Popup Form that prevents the parent form from being selected public static void ShowDialog(string title, string text, Primary owner) { text = text.Replace("\n", "\n\r\n"); ScrollMessageBox scr = new ScrollMessageBox(title, text); scr.Visible = false; scr.ShowDialog(owner); }
void Start() { map.enabled = false; secActive = Secondary.NONE; secondary.enabled = false; priActive = Primary.WOOD; clickTooFast = false; }
/// <summary> /// Writes entries to stream. /// </summary> /// <param name="stream">The stream.</param> internal void Write(Stream stream) { Primary.Update(Secondaries.ToList()); foreach (var entry in Entries) { entry.Write(stream); } }
public ColorSchemeValues(Primary primary, Primary darkPrimary, Primary lightPrimary, Accent accent, TextShade textShade) { this.primary = primary; this.darkPrimary = darkPrimary; this.lightPrimary = lightPrimary; this.accent = accent; this.textShade = textShade; }
public Toimintaalueentiedot(Primary p, Toimintaalue t) { this.p = p; this.t = t; InitializeComponent(); tbNimi.Text = t.Nimi; this.paivita(); }
public CacheCapacity(Primary primary,long val) { this.Primary = primary; if(this.Primary == Primary.COUNTONLY) { this.Count = val; this.Size = 0; } else if (this.Primary == Primary.SIZEONLY) { this.Size = val; this.Count = 0; } else { throw new Exception("Params don't match the Primary type"); } }
/// <summary> /// Defines the Color Scheme to be used for all forms. /// </summary> /// <param name="primary">The primary color, a -500 color is suggested here.</param> /// <param name="darkPrimary">A darker version of the primary color, a -700 color is suggested here.</param> /// <param name="lightPrimary">A lighter version of the primary color, a -100 color is suggested here.</param> /// <param name="accent">The accent color, a -200 color is suggested here.</param> /// <param name="textShade">The text color, the one with the highest contrast is suggested.</param> public ColorScheme(Primary primary, Primary darkPrimary, Primary lightPrimary, Accent accent, TextShade textShade) { //Color PrimaryColor = ((int) primary).ToColor(); DarkPrimaryColor = ((int) darkPrimary).ToColor(); LightPrimaryColor = ((int) lightPrimary).ToColor(); AccentColor = ((int) accent).ToColor(); TextColor = ((int) textShade).ToColor(); //Pen PrimaryPen = new Pen(PrimaryColor); DarkPrimaryPen = new Pen(DarkPrimaryColor); LightPrimaryPen = new Pen(LightPrimaryColor); AccentPen = new Pen(AccentColor); TextPen = new Pen(TextColor); //Brush PrimaryBrush = new SolidBrush(PrimaryColor); DarkPrimaryBrush = new SolidBrush(DarkPrimaryColor); LightPrimaryBrush = new SolidBrush(LightPrimaryColor); AccentBrush = new SolidBrush(AccentColor); TextBrush = new SolidBrush(TextColor); }
public Sprite getDisabledSprite(Primary type) { return primaries[type].disabled; }
public Sprite getGreyedSprite(Primary type) { return primaries[type].greyed; }
public Sprite getNormalSprite(Primary type) { return primaries[type].normal; }
public CacheCapacity(Primary primary, long count, long size) { this.Primary = primary; if (this.Primary == Primary.SIZECOUNT || this.Primary == Primary.COUNTSIZE) { this.Count = count; this.Size = size; } else { throw new Exception("Params don't match the Primary type"); } }
public virtual bool Equals(Primary obj) { if (ReferenceEquals(null, obj)) return false; if (ReferenceEquals(this, obj)) return true; return obj.id == id; }