/// <summary> /// Carga matriz multioperador desde un DataTable con la información /// </summary> /// <param name="data">Tabla con la información</param> public void CargarMatrizMultioperador(DataTable data) { _matriz_multioperador.Clear(); object[] headers = data.Rows[0].ItemArray; Dictionary <int, string> operadores = new Dictionary <int, string>(); int contador = 1; while (headers[contador].ToString().ToCharArray().Length > 0) { operadores.Add(contador, headers[contador].ToString()); contador++; } foreach (DataRow row in data.Rows) { if (data.Rows.IndexOf(row) >= 1 && row[0].ToString().ToCharArray().Length > 0) { object[] valores = row.ItemArray; string subflota = valores[0].ToString(); _matriz_multioperador.Add(subflota, new SerializableDictionary <string, int>()); contador = 1; while (contador < valores.Length && valores[contador].ToString().ToCharArray().Length > 0) { _matriz_multioperador[subflota].Add(operadores[contador], Convert.ToInt16(valores[contador])); contador++; } } } }
/// <summary> /// Carga matriz flota-flota desde un DataTable con la información /// </summary> /// <param name="data">Tabla con la información</param> public void CargarMatrizFlotaFlota(DataTable data) { _matriz_flota_flota.Clear(); object[] headersFlotas = data.Rows[0].ItemArray; int contador = 1; while (headersFlotas[contador].ToString().ToCharArray().Length > 0) { _matriz_flota_flota.Add(headersFlotas[contador].ToString(), new SerializableDictionary <string, double>()); contador++; } foreach (DataRow row in data.Rows) { if (data.Rows.IndexOf(row) >= 1 && row[0].ToString().ToCharArray().Length > 0) { object[] valores = row.ItemArray; string flota1 = valores[0].ToString(); contador = 1; foreach (string flota2 in _matriz_flota_flota.Keys) { _matriz_flota_flota[flota1].Add(flota2, Convert.ToDouble(valores[contador].ToString().Replace('.', ','))); contador++; } } } }
/// <summary> /// 释放资源 /// </summary> private void ResourceDispose() { if (_curAllSenderStatusDic != null) { _curAllSenderStatusDic.Clear(); _curAllSenderStatusDic = null; } if (_curAllSenderRefreshDic != null) { _curAllSenderRefreshDic.Clear(); _curAllSenderRefreshDic = null; } if (_curAllSenderGridDic != null) { _curAllSenderGridDic.Clear(); _curAllSenderGridDic = null; } if (_redundantStateType != null) { _redundantStateType.Clear(); _redundantStateType = null; } if (_tempRedundancyDict != null) { _tempRedundancyDict.Clear(); _tempRedundancyDict = null; } if (_commPortData != null) { _commPortData.Clear(); _commPortData = null; } if (CommPortLinePen != null) { CommPortLinePen.Dispose(); } if (CommPortStrBrush != null) { CommPortStrBrush.Dispose(); } if (CommPortLine != null) { CommPortLine.Dispose(); } if (SenderBoarderAndLinePen != null) { SenderBoarderAndLinePen.Dispose(); } if (SenderBrush != null) { SenderBrush.Dispose(); } if (SenderIndexBrush != null) { SenderIndexBrush.Dispose(); } }
private void btnBuild3GbXML_Click(object sender, EventArgs e) { AbortRequested = false; ObjectEnabling(false); PhraseGenerator pg = new PhraseGenerator(); MassiveXML.Clear(); long TotalSize = 0; int OuterIndex = 0; while (!AbortRequested && TotalSize < 25000000L) { OuterIndex++; this.lblFileSizeXML.Text = string.Format("{0} bytes and still working", Formatting.KiloToYotta(TotalSize)); this.lblFileSizeXML.Refresh(); Application.DoEvents(); System.Threading.Thread.Sleep(100); long ThisSize = 0; SerializableDictionary <int, string> Localized = new SerializableDictionary <int, string>(); int InnerIndex = 0; while (!AbortRequested && ThisSize < 10000000L) { foreach (string Phrase in pg.GetPhrase(1000)) { InnerIndex++; Localized.Add(InnerIndex, Phrase); ThisSize += (long)Phrase.Length; } Application.DoEvents(); } MassiveXML.Add(OuterIndex, Localized); TotalSize += ThisSize; } if (!AbortRequested) { this.lblFileSizeXML.Text = string.Format("{0} bytes..Saving XML file", Formatting.KiloToYotta(TotalSize)); this.lblFileSizeXML.Refresh(); ObjectXMLSerializer <SerializableDictionary <int, SerializableDictionary <int, string> > > .SaveDocumentFormat(MassiveXML, this.lblFileNameXML.Text); this.lblFileSizeXML.Text = string.Format("{0} bytes..Saving XML GZ file", Formatting.KiloToYotta(TotalSize)); this.lblFileSizeXML.Refresh(); ObjectXMLSerializer <SerializableDictionary <int, SerializableDictionary <int, string> > > .SaveCompressedDocumentFormat(MassiveXML, this.lblFileNameXML.Text + ".gz"); string rawSize = Formatting.KiloToYotta((double)new FileInfo(this.lblFileNameXML.Text).Length); string gzSize = Formatting.KiloToYotta((double)new FileInfo(this.lblFileNameXML.Text + ".gz").Length); this.lblFileSizeXML.Text = string.Format("Save Complete: Memory = {0}, XML = {1}, XML/GZ = {2}", TotalSize, rawSize, gzSize); //new FileInfo(this.lblFileNameXML.Text).Length, //new FileInfo(this.lblFileNameXML.Text + ".gz").Length); } else { this.lblFileSizeXML.Text = "Aborted by operator"; } ObjectEnabling(true); }
/// <summary> /// Loads the driver package and saves it in the cache. /// </summary> /// <param name="driversDirectory">Location of the driver distribution.</param> /// <param name="includeAllArchitectures">if set to <c>true</c> all architectures are included.</param> public void LoadDrivers(string driversDirectory, bool includeAllArchitectures) { // Clear out the print drivers when loading a new set of drivers. _printDrivers.Clear(); _propertiesSet.Clear(); var drivers = DriverController.LoadFromDirectory(driversDirectory, includeAllArchitectures); foreach (DriverDetails driver in drivers) { AddDriver(new PrintDeviceDriver(driver)); } }
public void ClearCache() { lock (cache) { cache.Clear(); } }
private void button2_Click(object sender, EventArgs e) { cache.Clear(); saap.UpdateCache(cache); cache = saap.GetCache(); saap_UpdatedArpCache(); }
private void ModUpdate(object sender, EventArgs e) { if (isInitialized) { if ((Game1.player.currentLocation.name != null && previousLocation.name != Game1.player.currentLocation.name)) { allSeedMakers.Clear(); foreach (KeyValuePair <Vector2, StardewValley.Object> allObjects in Game1.player.currentLocation.objects) { if (allObjects.Value.name.Equals("Seed Maker")) { allSeedMakers.Add(allObjects.Value, new allSeedMakerValueContainer(null, allObjects.Value.heldObject != null? true : false)); } } previousLocation = Game1.player.currentLocation; } List <StardewValley.Object> seedMakers = allSeedMakers.Keys.ToList(); foreach (StardewValley.Object seedMaker in seedMakers) { if (seedMaker.heldObject != null && allSeedMakers[seedMaker].hasBeenChecked == false && allSeedMakers[seedMaker].droppedObject == null) { allSeedMakers[seedMaker].droppedObject = previousHeldItem; seedMaker.heldObject.addToStack(allSeedMakers[seedMaker].droppedObject.quality == 4 ? allSeedMakers[seedMaker].droppedObject.quality - 1 : allSeedMakers[seedMaker].droppedObject.quality); allSeedMakers[seedMaker].hasBeenChecked = true; } if (seedMaker.heldObject == null && allSeedMakers[seedMaker].hasBeenChecked == true) { allSeedMakers[seedMaker].droppedObject = null; allSeedMakers[seedMaker].hasBeenChecked = false; } } previousHeldItem = Game1.player.ActiveObject; } }
public new void Clear() { SyncRoot.EnterWriteLock(); nameCache.Clear(); nameHandleCache.Clear(); nameUUIDHandleCache.Clear(); base.Clear(); SyncRoot.ExitWriteLock(); }
private void InitializeControlBindings() { if (_controlBindings == null) { _controlBindings = new SerializableDictionary <CpdInputControls, ControlBinding>(); } _controlBindings.Clear(); foreach (CpdInputControls val in Enum.GetValues(typeof(CpdInputControls))) { _controlBindings.Add(val, new ControlBinding()); } }
internal Linters SaveLinterSettings(SerializableDictionary <string, bool> boolOptions) { //TODO HACK // really the view model should be capable of producing options from itself if (boolOptions != this._options.BoolOptions2) { boolOptions.Clear(); foreach (KeyValuePair <string, bool> option in this._options.BoolOptions2) { boolOptions[option.Key] = option.Value; } } return(_options.SelectedLinter); }
/// <summary> /// 释放资源 /// </summary> public void DisposeAllInfo() { if (_customToolTip != null) { _customToolTip.Close(); _customToolTip.Dispose(); _customToolTip = null; } if (_tempRedundancyDict != null) { _tempRedundancyDict.Clear(); _tempRedundancyDict = null; } _senderStatusUC.MouseMoveInGridEvent -= new MouseOperateInGridEventHandler(SenderStatusUC_MouseMoveInGridEvent); }
private void btnDismissApp_Click(object sender, RoutedEventArgs e) { persistedQueries.Clear(); int i = 0; foreach (var s in PeristedQList) { persistedQueries.Add(i++, s); } var serializer = new XmlSerializer(persistedQueries.GetType()); var writer = new StreamWriter(_fileName); serializer.Serialize(writer, persistedQueries); writer.Close(); Application.Current.Shutdown(); }
protected void ClearDictionary() { _Dictionary.Clear(); }
private void OnDestroy() { //In the case of the matrix remaining in memory after the round ends, this will ensure the MetaDataNodes are GC nodes.Clear(); }
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { Initialize(property, label); position.height = SingleLineHeight; var foldoutRect = position; foldoutRect.width -= 2 * kButtonWidth; EditorGUI.BeginChangeCheck(); IsFoldout = EditorGUI.Foldout(foldoutRect, IsFoldout, label, true); if (EditorGUI.EndChangeCheck()) { EditorPrefs.SetBool(label.text, IsFoldout); } if (!IsFoldout) { return; } var buttonRect = position; buttonRect.x = position.width - kButtonWidth + position.x; buttonRect.width = kButtonWidth; if (GUI.Button(buttonRect, new GUIContent("+", "Add item"), EditorStyles.miniButton)) { AddNewItem(); } buttonRect.x -= kButtonWidth; if (GUI.Button(buttonRect, new GUIContent("X", "Clear dictionary"), EditorStyles.miniButtonRight)) { ClearDictionary(); } foreach (var item in dictionary) { var key = item.Key; var value = item.Value; position.y += SingleLineHeight; var keyRect = position; keyRect.width /= 2; keyRect.width -= 4; EditorGUI.BeginChangeCheck(); var newKey = DisplayKeyValueField(keyRect, typeof(TKey), key); if (EditorGUI.EndChangeCheck()) { try { List <TKey> keys = new List <TKey>(dictionary.Keys); List <TValue> values = new List <TValue>(dictionary.Values); dictionary.Clear(); for (int i = 0; i < keys.Count; i++) { if (keys[i].Equals(key)) { dictionary.Add(newKey, value); } else { dictionary.Add(keys[i], values[i]); } } } catch (Exception e) { Debug.LogError(e.Message); } break; } var valueRect = position; valueRect.x = position.width / 2 + 15; valueRect.width = keyRect.width - kButtonWidth; EditorGUI.BeginChangeCheck(); value = DisplayKeyValueField(valueRect, typeof(TValue), value); if (EditorGUI.EndChangeCheck()) { dictionary[key] = value; break; } var removeRect = valueRect; removeRect.x = valueRect.xMax + 2; removeRect.width = kButtonWidth; if (GUI.Button(removeRect, new GUIContent("x", "Remove item"), EditorStyles.miniButtonRight)) { dictionary.Remove(key); break; } } if (GUI.changed) { EditorUtility.SetDirty(property.serializedObject.targetObject); } }
public static void ClearProfiles() { internalList.Clear(); }
/// <summary> /// Regarga la vista dictionary de los parámetros de la disrupción /// </summary> internal override void Refresh() { base.Refresh(); _parametros.Clear(); _parametros = DataTableToDictionary(Data); }
internal Linters SaveLinterSettings(SerializableDictionary<string, bool> boolOptions) { //TODO HACK // really the view model should be capable of producing options from itself if (boolOptions != this._options.BoolOptions2) { boolOptions.Clear(); foreach (KeyValuePair<string, bool> option in this._options.BoolOptions2) { boolOptions[option.Key] = option.Value; } } return _options.SelectedLinter; }
/// <summary> /// 清除游戏排行榜数据 /// </summary> public void ClearContestRankingData() { StateStorage.ClearData(Key); ContestRankingDataDictionary.Clear(); }
public void ClearProfiles() { profileFlows.Clear(); profileElevations.Clear(); ratingCurve.Clear(); }
/// <summary> /// Limpia diccionario de Turn Around Mínimos especiales por tramo /// </summary> public void LimpiarTurnAroundCustom() { _turn_around_custom.Clear(); }
public void clearStates() { savedStates.Clear(); }
private void ClearDictionary() { _Dictionary.Clear(); }
public void ClearStates() { _dockStates.Clear(); }