private void ProcessFactories(XmlNode node, IList factories) { foreach ( XmlNode child in node.ChildNodes ) { Type type; switch ( child.LocalName ) { case "add": type = Type.GetType(child.Attributes["type"].Value); if ( !factories.Contains(type) ) factories.Add(type); break; case "remove": type = Type.GetType(child.Attributes["type"].Value); if ( factories.Contains(type) ) factories.Remove(type); break; case "clear": factories.Clear(); break; default: // gives obsolete warning but needed for .NET 1.1 support throw new ConfigurationException(string.Format("Unknown element '{0}' in section '{0}'", child.LocalName, node.LocalName)); } } }
public static void Apply(this FilterScheme filterScheme, IEnumerable rawCollection, IList filteredCollection) { Argument.IsNotNull("filterScheme", filterScheme); Argument.IsNotNull("rawCollection", rawCollection); Argument.IsNotNull("filteredCollection", filteredCollection); IDisposable suspendToken = null; var filteredCollectionType = filteredCollection.GetType(); if (filteredCollectionType.IsGenericTypeEx() && filteredCollectionType.GetGenericTypeDefinitionEx() == typeof(FastObservableCollection<>)) { suspendToken = (IDisposable)filteredCollectionType.GetMethodEx("SuspendChangeNotifications").Invoke(filteredCollection, null); } filteredCollection.Clear(); foreach (object item in rawCollection) { if (filterScheme.CalculateResult(item)) { filteredCollection.Add(item); } } if (suspendToken != null) { suspendToken.Dispose(); } }
public static void RegisterDisplayModes(IList<IDisplayMode> displayModes) { var modeDesktop = new DefaultDisplayMode("") { ContextCondition = (c => c.Request.IsDesktop()) }; var modeSmartphone = new DefaultDisplayMode("smartphone") { ContextCondition = (c => c.Request.IsSmartphone()) }; var modeTablet = new DefaultDisplayMode("tablet") { ContextCondition = (c => c.Request.IsTablet()) }; var modeLegacy = new DefaultDisplayMode("legacy") { ContextCondition = (c => c.Request.IsLegacy()) }; displayModes.Clear(); displayModes.Add(modeSmartphone); displayModes.Add(modeTablet); displayModes.Add(modeLegacy); displayModes.Add(modeDesktop); }
public void Apply(IList<IElement> elements, DecompilationContext context) { var results = new List<IElement>(); this.ProcessRange(elements, 0, results, new Dictionary<IElement, IElement>()); elements.Clear(); elements.AddRange(results); }
public void Select(IList<IIndividual> Individuals, int firstSize, int secondSize) { ElitismSelection eliteSelection = new ElitismSelection(); WheelSelection wheelSelection = new WheelSelection(); IList<IIndividual> eliteIndividuals = new List<IIndividual>(); IList<IIndividual> wheelIndividuals = new List<IIndividual>(); (Individuals as List<IIndividual>).ForEach( i => { eliteIndividuals.Add(i.Clone()); wheelIndividuals.Add(i.Clone()); } ); eliteSelection.Select(eliteIndividuals, firstSize); wheelSelection.Select(wheelIndividuals, secondSize); Individuals.Clear(); (eliteIndividuals as List<IIndividual>).ForEach( i => Individuals.Add(i) ); (wheelIndividuals as List<IIndividual>).ForEach( i => Individuals.Add(i) ); }
/// <summary> /// Removes containing paths and merge overlapping paths. /// </summary> /// <param name="scaffoldPaths">Input paths/scaffold.</param> public void PurgePath(IList<ScaffoldPath> scaffoldPaths) { if (scaffoldPaths != null && 0 != scaffoldPaths.Count) { this.internalScaffoldPaths = scaffoldPaths.AsParallel().OrderBy(t => t.Count).ToList(); bool isUpdated = true; bool[] isConsumed = new bool[this.internalScaffoldPaths.Count]; while (isUpdated) { isUpdated = false; for (int index = 0; index < this.internalScaffoldPaths.Count; index++) { if (null != this.internalScaffoldPaths[index] && 0 != this.internalScaffoldPaths[index].Count && !isConsumed[index]) { isUpdated |= this.SearchContainingAndOverlappingPaths(this.internalScaffoldPaths[index], isConsumed); } else { isConsumed[index] = true; } } } this.UpdatePath(isConsumed); scaffoldPaths.Clear(); ((List<ScaffoldPath>)scaffoldPaths).AddRange(this.internalScaffoldPaths); } }
public void Select(IList<IIndividual> Individuals, int firstSize, int secondSize) { ElitismSelection eliteSelection = new ElitismSelection(); UniversalSelection universalSelection = new UniversalSelection(); IList<IIndividual> eliteIndividuals = new List<IIndividual>(); IList<IIndividual> universalIndividuals = new List<IIndividual>(); (Individuals as List<IIndividual>).ForEach( i => { eliteIndividuals.Add(i.Clone()); universalIndividuals.Add(i.Clone()); } ); eliteSelection.Select(eliteIndividuals, firstSize); universalSelection.Select(universalIndividuals, secondSize); Individuals.Clear(); (eliteIndividuals as List<IIndividual>).ForEach( i => Individuals.Add(i) ); (universalIndividuals as List<IIndividual>).ForEach( i => Individuals.Add(i) ); }
public void AugmentCompletionSession(ICompletionSession session, IList<CompletionSet> completionSets) { if (IsHtmlFile && completionSets.Any()) { var bottomSpan = completionSets.First().ApplicableTo; if (!JScriptEditorUtil.IsInJScriptLanguageBlock(_lbm, bottomSpan.GetStartPoint(bottomSpan.TextBuffer.CurrentSnapshot))) { // This is an HTML statement completion session, so do nothing return; } } // TODO: Reflect over the ShimCompletionSet to see where the Description value comes from // as setting the property does not actually change the value. var newCompletionSets = completionSets .Select(cs => cs == null ? cs : new ScriptCompletionSet( cs.Moniker, cs.DisplayName, cs.ApplicableTo, cs.Completions .Select(c => c == null ? c : new Completion( c.DisplayText, c.InsertionText, DocCommentHelper.ProcessParaTags(c.Description), c.IconSource, c.IconAutomationText)) .ToList(), cs.CompletionBuilders)) .ToList(); completionSets.Clear(); newCompletionSets.ForEach(cs => completionSets.Add(cs)); }
public void Clear(IList list) { if (list != null) { list.Clear(); } }
private void Apply(IList toFree) { for (var slotIter = toFree.GetEnumerator(); slotIter.MoveNext();) { var slot = ((Slot) slotIter.Current); _freespaceManager.Free(slot); } toFree.Clear(); }
public void SaveChange() { if (commandList.Count > 0) { using (SqlConnection conn = new SqlConnection(SqlConnectionPool.GetConnection(SqlConnectionPool.SqlConnecctionType.Write))) { conn.Open(); using (SqlTransaction trans = conn.BeginTransaction()) { try { foreach (var item in commandList) { item.Connection = conn; item.Transaction = trans; item.ExecuteNonQuery(); } trans.Commit(); } catch (Exception) { trans.Rollback(); } finally { commandList?.Clear(); } } } } }
public static bool Test(IList<VibrationMotor> input, VibrationMotor[] pattern) { int count = input.Count; bool flag = false; int num = 0; for (int index = 0; index + num < pattern.Length && index < count; ++index) { while (pattern[pattern.Length - index - 1 - num] == VibrationMotor.None) { ++num; if (index + num >= pattern.Length) break; } if (input[count - index - 1] == pattern[pattern.Length - index - 1 - num]) { if (index == pattern.Length - 1 - num) { flag = true; input.Clear(); break; } } else break; } return flag; }
public void LoadNpcCars(World world, IList<Car> list, int quantity, Texture2D[] textures) { list.Clear(); //Delete any existing cars in operation var rand = new Random(); var laneNum = 0; for(var i = 0; i < quantity; i++) { var spawnAttempts = 0; var textureId = rand.Next(0, textures.Count()-1); var newCar = new Car(textures[textureId]); world.InitializeNpcCar(newCar, laneNum, ref rand); world.OptimizeSpawnPosition(this, list, newCar, laneNum, ref rand, ref spawnAttempts); //If the car did not hit its number of maximum spawn attempts, assume it safe-spawned and spawn it if(spawnAttempts <= World.MaxSpawnAttempts) { list.Add(newCar); laneNum++; if (laneNum >= world.Lanes.Count()) laneNum = 0; } } }
protected void Arrange() { var random = new Random(); _closingRegister = new List<EventArgs>(); _exceptionRegister = new List<ExceptionEventArgs>(); _localEndpoint = new IPEndPoint(IPAddress.Loopback, 8122); _remoteEndpoint = new IPEndPoint(IPAddress.Parse("193.168.1.5"), random.Next(IPEndPoint.MinPort, IPEndPoint.MaxPort)); _connectionInfoMock = new Mock<IConnectionInfo>(MockBehavior.Strict); _sessionMock = new Mock<ISession>(MockBehavior.Strict); _connectionInfoMock.Setup(p => p.Timeout).Returns(TimeSpan.FromSeconds(15)); _sessionMock.Setup(p => p.IsConnected).Returns(true); _sessionMock.Setup(p => p.ConnectionInfo).Returns(_connectionInfoMock.Object); _forwardedPort = new ForwardedPortLocal(_localEndpoint.Address.ToString(), (uint)_localEndpoint.Port, _remoteEndpoint.Address.ToString(), (uint)_remoteEndpoint.Port); _forwardedPort.Closing += (sender, args) => _closingRegister.Add(args); _forwardedPort.Exception += (sender, args) => _exceptionRegister.Add(args); _forwardedPort.Session = _sessionMock.Object; _forwardedPort.Start(); _forwardedPort.Stop(); _closingRegister.Clear(); }
/// <summary> /// Executes the future queries. /// </summary> /// <param name="context">The <see cref="ObjectContext"/> to run the queries against.</param> /// <param name="futureQueries">The future queries list.</param> public void ExecuteFutureQueries(ObjectContext context, IList<IFutureQuery> futureQueries) { if (context == null) throw new ArgumentNullException("context"); if (futureQueries == null) throw new ArgumentNullException("futureQueries"); // used to call internal methods dynamic contextProxy = new DynamicProxy(context); contextProxy.EnsureConnection(); try { using (var command = CreateFutureCommand(context, futureQueries)) using (var reader = command.ExecuteReader()) { foreach (var futureQuery in futureQueries) { futureQuery.SetResult(context, reader); reader.NextResult(); } } } finally { contextProxy.ReleaseConnection(); // once all queries processed, clear from queue futureQueries.Clear(); } }
public void AugmentCompletionSession(ICompletionSession session, IList<CompletionSet> completionSets) { int position = session.TextView.Caret.Position.BufferPosition.Position; var line = _buffer.CurrentSnapshot.Lines.SingleOrDefault(l => l.Start <= position && l.End > position); if (line != null) { string text = line.GetText(); int tagIndex = text.IndexOf("getElementsByTagName("); int classIndex = text.IndexOf("getElementsByClassName("); int idIndex = text.IndexOf("getElementById("); CompletionSet set = null; if (tagIndex > -1 && position > line.Start + tagIndex) set = GetElementsByTagName(completionSets, position, line, text, tagIndex + 21); if (classIndex > -1 && position > line.Start + classIndex) set = GetElementsByClassName(completionSets, position, line, text, classIndex + 23); if (idIndex > -1 && position > line.Start + idIndex) set = GetElementById(completionSets, position, line, text, idIndex + 15); if (set != null) { completionSets.Clear(); completionSets.Add(set); } } }
public void AugmentSignatureHelpSession(ISignatureHelpSession session, IList<ISignature> signatures) { SnapshotPoint? point = session.GetTriggerPoint(_buffer.CurrentSnapshot); if (!point.HasValue) return; CssEditorDocument document = CssEditorDocument.FromTextBuffer(_buffer); ParseItem item = document.StyleSheet.ItemBeforePosition(point.Value.Position); if (item == null) return; Declaration dec = item.FindType<Declaration>(); if (dec == null || dec.PropertyName == null || dec.Colon == null) return; var span = _buffer.CurrentSnapshot.CreateTrackingSpan(dec.Colon.Start, dec.Length - dec.PropertyName.Length, SpanTrackingMode.EdgeNegative); ValueOrderFactory.AddSignatures method = ValueOrderFactory.GetMethod(dec); if (method != null) { signatures.Clear(); method(session, signatures, dec, span); Dispatcher.CurrentDispatcher.BeginInvoke( new Action(() => { session.Properties.AddProperty("dec", dec); session.Match(); }), DispatcherPriority.Normal, null); } }
public Task CreatePeripheral() { peripheralManager = new CBPeripheralManager(this, DispatchQueue.CurrentQueue, InitOptions); servicesList?.Clear(); characteristicsList?.Clear(); return(Task.CompletedTask); }
public static void RecursiveDelete(string directorypath, IList<DirectoryInfo> directorylist) { if (Directory.Exists(directorypath)) { DirectoryInfo directory = new DirectoryInfo(directorypath); CollateSubfoldersList(directory, directorylist); //Populate the subfolders to be deleted foreach (DirectoryInfo d in directorylist) { try { if (d.Exists) d.Delete(true); } catch (IOException) { // Hack: http://stackoverflow.com/questions/329355/cannot-delete-directory-with-directory-deletepath-true // If you are getting IOException deleting directories that are open // in Explorer, add a sleep(0) to give Explorer a chance to release // the directory handle. //System.Threading.Thread.Sleep(0); if (d.Exists) d.Delete(true); } } directorylist.Clear(); } }
public static void ExecuteAction(string actionName, IList<string> parameters) { IAction actionInstance; if (ActionExists(actionName)) { actionInstance = GetActionInstance(actionName); } else { actionInstance = new Help(); parameters.Clear(); } if (parameters.Count != actionInstance.ParametersCount) { // -1 signifie un nombre illimité d'arguments (mais pas 0) if (actionInstance.ParametersCount != -1) { string puralIfNeeded = actionInstance.ParametersCount != 1 ? "s" : ""; Console.WriteLine( "This action require {0} parameter{1}.", actionInstance.ParametersCount, puralIfNeeded); return; } } actionInstance.Execute(parameters); }
public void AugmentSignatureHelpSession(ISignatureHelpSession session, IList<ISignature> signatures) { if (!session.TextView.Properties.ContainsProperty(SessionKey)) { return; } // At the moment there is a bug in the javascript provider which causes it to // repeatedly insert the same Signature values into an ISignatureHelpSession // instance. There is no way, other than reflection, for us to prevent this // from happening. Instead we just ensure that our provider runs after // Javascript and then remove the values they add here signatures.Clear(); // Map the trigger point down to our buffer. var subjectTriggerPoint = session.GetTriggerPoint(subjectBuffer.CurrentSnapshot); if (!subjectTriggerPoint.HasValue) { return; } var currentSnapshot = subjectTriggerPoint.Value.Snapshot; var querySpan = new SnapshotSpan(subjectTriggerPoint.Value, 0); var applicableToSpan = currentSnapshot.CreateTrackingSpan( querySpan.Start.Position, 0, SpanTrackingMode.EdgeInclusive); string encouragement = encouragements.GetRandomEncouragement(); if (encouragement != null) { var signature = new Signature(applicableToSpan, encouragement, "", ""); signatures.Add(signature); } }
public void CleanUp() { _options.Clear(); _chats.Clear(); _secretChats.Clear(); _users.Clear(); _usersFull.Clear(); _basicGroups.Clear(); _basicGroupsFull.Clear(); _supergroups.Clear(); _supergroupsFull.Clear(); _chatsMap.Clear(); _usersMap.Clear(); _promotedChatId = 0; _favoriteStickers?.Clear(); _installedStickerSets?.Clear(); _installedMaskSets?.Clear(); _authorizationState = null; _connectionState = null; }
internal static void SetUpIdNameMap() { if (initialized) { return; } objects?.Clear(); objects = new List <Variable>(); objectNames = new Dictionary <ObjectIdentifier, string>(); AddElem("1.0.62439.2.21.0.1.0.1.1.9.1", "status_a"); // lreLinkStatusA AddElem("1.0.62439.2.21.0.1.0.1.1.10.1", "status_b"); // lreLinkStatusB AddElem("1.0.62439.2.21.0.1.0.1.1.7.1", "port_a"); // lrePortAdminStateA AddElem("1.0.62439.2.21.0.1.0.1.1.8.1", "port_b"); // lrePortAdminStateB AddElem("1.0.62439.2.21.1.1.0.1.1.2.1", "tx_a"); // lreCntTxA AddElem("1.0.62439.2.21.1.1.0.1.1.3.1", "tx_b"); // lreCntTxB AddElem("1.0.62439.2.21.1.1.0.1.1.4.1", "tx_c"); // lreCntTxC AddElem("1.0.62439.2.21.1.1.0.1.1.8.1", "rx_a"); // lreCntRxA AddElem("1.0.62439.2.21.1.1.0.1.1.9.1", "rx_b"); // lreCntRxB AddElem("1.0.62439.2.21.1.1.0.1.1.10.1", "rx_c"); // lreCntRxC AddElem("1.0.62439.2.21.1.1.0.1.1.11.1", "error_a"); // lreCntErrorsA AddElem("1.0.62439.2.21.1.1.0.1.1.12.1", "error_b"); // lreCntErrorsB AddElem("1.0.62439.2.21.1.1.0.1.1.13.1", "error_c"); // lreCntErrorsC AddElem("1.0.62439.2.21.1.1.0.1.1.25.1", "o_rx_a"); // lreCntOwnRxA AddElem("1.0.62439.2.21.1.1.0.1.1.26.1", "o_rx_b"); // lreCntOwnRxB initialized = true; }
void InitializeListOfPayments() { otherPaymentsFromDB?.Clear(); foreach (PaymentByCardOnline payment in paymentsByCard) { if (payment.PaymentStatus != PaymentStatus.CONFIRMED) { payment.Color = colorLightRed; payment.Selected = payment.Selectable = false; } else if (payment.PaymentStatus == PaymentStatus.CONFIRMED && IsPaymentUploadedAlready(payment)) { payment.Color = colorYellow; payment.Selected = payment.Selectable = false; payment.IsDuplicate = true; } else if (payment.PaymentStatus == PaymentStatus.CONFIRMED && !IsPaymentUploadedAlready(payment)) { payment.Color = colorWhite; payment.Selected = payment.Selectable = true; payment.IsDuplicate = false; } payment.PropertyChanged += (s, ea) => { if (ea.PropertyName == payment.GetPropertyName(p => p.Selected)) { UpdateDescription(); } }; } }
public void CopyIdeasInto(IList<Idea> destination) { // TODO: Merge? destination.Clear(); foreach (var idea in _ideas) destination.Add(idea); }
protected void Arrange() { var random = new Random(); _subsystemName = random.Next().ToString(CultureInfo.InvariantCulture); _operationTimeout = TimeSpan.FromSeconds(30); _encoding = Encoding.UTF8; _disconnectedRegister = new List<EventArgs>(); _errorOccurredRegister = new List<ExceptionEventArgs>(); _channelExceptionEventArgs = new ExceptionEventArgs(new SystemException()); _sessionMock = new Mock<ISession>(MockBehavior.Strict); _channelMock = new Mock<IChannelSession>(MockBehavior.Strict); var sequence = new MockSequence(); _sessionMock.InSequence(sequence).Setup(p => p.CreateChannelSession()).Returns(_channelMock.Object); _channelMock.InSequence(sequence).Setup(p => p.Open()); _channelMock.InSequence(sequence).Setup(p => p.SendSubsystemRequest(_subsystemName)).Returns(true); _channelMock.InSequence(sequence).Setup(p => p.Close()); _channelMock.InSequence(sequence).Setup(p => p.Dispose()); _subsystemSession = new SubsystemSessionStub( _sessionMock.Object, _subsystemName, _operationTimeout, _encoding); _subsystemSession.Disconnected += (sender, args) => _disconnectedRegister.Add(args); _subsystemSession.ErrorOccurred += (sender, args) => _errorOccurredRegister.Add(args); _subsystemSession.Connect(); _subsystemSession.Dispose(); _disconnectedRegister.Clear(); _errorOccurredRegister.Clear(); }
/// <summary> /// /// </summary> /// <param name="reader"></param> /// <param name="transactions"></param> internal static void Read(XmlReader reader, IList<TransactionSummary> transactions, bool preApproval) { transactions.Clear(); if (reader.IsEmptyElement) { XMLParserUtils.SkipNode(reader); } if (preApproval == true) reader.ReadStartElement(TransactionSummaryListSerializer.PreApprovals); else reader.ReadStartElement(TransactionSummaryListSerializer.Transactions); reader.MoveToContent(); while (!reader.EOF) { if (preApproval == true) { if (XMLParserUtils.IsEndElement(reader, TransactionSummaryListSerializer.PreApprovals)) { XMLParserUtils.SkipNode(reader); break; } } else { if (XMLParserUtils.IsEndElement(reader, TransactionSummaryListSerializer.Transactions)) { XMLParserUtils.SkipNode(reader); break; } } if (reader.NodeType == XmlNodeType.Element) { TransactionSummary transaction = new TransactionSummary(); switch (reader.Name) { case TransactionSerializerHelper.Transaction: TransactionSummarySerializer.Read(reader, transaction, preApproval); transactions.Add(transaction); break; case TransactionSerializerHelper.PreApproval: TransactionSummarySerializer.Read(reader, transaction, preApproval); transactions.Add(transaction); break; default: XMLParserUtils.SkipElement(reader); break; } } else { XMLParserUtils.SkipNode(reader); } } }
private void DespawnAllAgents() { foreach (var vehicle in vehicles) { Destroy(vehicle.gameObject); } vehicles?.Clear(); }
public void FilterErrorList(IList<ICssError> errors, ICssCheckerContext context) { Document doc = EditorExtensionsPackage.DTE.ActiveDocument; if (doc == null || string.IsNullOrEmpty(doc.FullName) || !doc.FullName.EndsWith(".scss", StringComparison.OrdinalIgnoreCase)) return; errors.Clear(); }
public void SetContentTypes(IList<MediaTypeHeaderValue> contentTypes) { contentTypes.Clear(); foreach (var contentType in ContentTypes) { contentTypes.Add(contentType); } }
public void get_BreaksValues(ref IList<double> lstVal/*, ref int iInterval*/) { lstVal.Clear(); foreach(double d in m_lstBreakValues) { lstVal.Add(d); } //iInterval = lstVal.Count; }
public void UpdatePolicies(ISecurityPolicy securityPolicyToAdd, IList<ISecurityPolicy> policies) { if (securityPolicyToAdd == null) throw new ArgumentNullException("securityPolicyToAdd"); if (policies == null) throw new ArgumentNullException("policies"); if (securityPolicyToAdd.IsPolicyOf<IgnorePolicy>()) policies.Clear(); else if (securityPolicyToAdd.IsPolicyOf<DenyAnonymousAccessPolicy>()) policies.Clear(); else if (securityPolicyToAdd.IsPolicyOf<DenyAuthenticatedAccessPolicy>()) policies.Clear(); else if (securityPolicyToAdd.IsPolicyOf<RequireAnyRolePolicy>()) policies.Clear(); else if (securityPolicyToAdd.IsPolicyOf<RequireAllRolesPolicy>()) policies.Clear(); policies.Add(securityPolicyToAdd); }
public void RefreshSelected(ref IList<Program> list, System.Collections.IList SelectItems) { list.Clear(); foreach (Program item in SelectItems) { Program temp = new Program(item); list.Add(temp); } }
public static void CopyMarks(IList<string> to, IList<string> from) { to.Clear(); foreach (var v in from) { to.Add(v); } }
private void Dispose(IList<Stream> data) { foreach (var stream in data) { stream.Close(); stream.Dispose(); } data.Clear(); }
/*--------------------------------------------------------------------------------------------*/ public static void SplitTrackSegments(ReadOnlyCollection<TrackSegment> pSegments, ReadOnlyCollection<TrackSegment> pCuts, IList<TrackSegment> pSliceResults) { pSliceResults.Clear(); for ( int segI = 0 ; segI < pSegments.Count ; segI++ ) { TrackSegment seg = pSegments[segI]; pSliceResults.Add(seg); } for ( int cutI = 0 ; cutI < pCuts.Count ; cutI++ ) { TrackSegment cut = pCuts[cutI]; for ( int sliceI = 0 ; sliceI < pSliceResults.Count ; sliceI++ ) { TrackSegment slice = pSliceResults[sliceI]; if ( cut.StartValue >= slice.StartValue && cut.EndValue <= slice.EndValue ) { var slice2 = new TrackSegment(); slice2.StartValue = cut.EndValue; slice2.EndValue = slice.EndValue; slice2.IsFill = slice.IsFill; pSliceResults.Insert(sliceI+1, slice2); slice.EndValue = cut.StartValue; pSliceResults[sliceI] = slice; continue; } if ( cut.StartValue >= slice.StartValue && cut.StartValue <= slice.EndValue ) { slice.EndValue = cut.StartValue; pSliceResults[sliceI] = slice; continue; } if ( cut.EndValue <= slice.EndValue && cut.EndValue >= slice.StartValue ) { slice.StartValue = cut.EndValue; pSliceResults[sliceI] = slice; continue; } if ( cut.StartValue <= slice.StartValue && cut.EndValue >= slice.EndValue ) { pSliceResults.RemoveAt(sliceI); sliceI--; } } } for ( int sliceI = 0 ; sliceI < pSliceResults.Count ; sliceI++ ) { TrackSegment slice = pSliceResults[sliceI]; if ( Math.Abs(slice.StartValue-slice.EndValue) <= 0.01f ) { pSliceResults.RemoveAt(sliceI); sliceI--; } } }
private void PopulateComPortsComboBox(bool showAll = false) { ComPortName.BeginUpdate(); comPortDescriptors?.Clear(); comPortDescriptors = EnumerateComPorts(showAll).ToList(); ComPortName.DataSource = comPortDescriptors; ComPortName.DisplayMember = "Caption"; ComPortName.ValueMember = "PortName"; ComPortName.EndUpdate(); ComPortName.Invalidate(); }
public virtual void Dispose() { SelectedItem = null; BindingOperations.ClearBinding(this, ItemsSourceProperty); Items.Clear(); Model = null; _dragItem = null; _childrenBounds?.Clear(); _childrenBounds = null; Disposed(this, new EventArgs()); }
private void MainForm_FormClosing(object sender, FormClosingEventArgs e) { _instructions?.Clear(); _instructions = null; _executionEnvironment?.Dispose(); _executionEnvironment = null; _executor?.Dispose(); _executor = null; }
/// <summary> /// Disposes the resources. /// </summary> /// <param name="disposing"></param> protected override void Dispose(bool disposing) { if (disposing) { _headers?.Clear(); _datas?.Clear(); _reader?.Dispose(); } base.Dispose(disposing); }
protected virtual void Dispose(bool disposing) { if (!disposedValue) { if (disposing) { m_missingPixels?.Clear(); } m_missingPixels = null; disposedValue = true; } }
/// <inheritdoc cref="FindWith"/> public IMatchLimitations FindWith(Func <FindOptions, FindLimitations, IMatchFinder> matchFinderFactory) { ContractAssertions.IsNotNull(matchFinderFactory, nameof(matchFinderFactory)); _limitFactories?.Clear(); _matchFinderFactories = new List <Func <FindOptions, FindLimitations, IMatchFinder> > { matchFinderFactory }; return(this); }
internal static void CreatePropertyViewModel(IList <PropertyViewModel> filterProperty, IEnumerable <string> input) { filterProperty?.Clear(); foreach (var property in input) { filterProperty.Add(new PropertyViewModel() { Property = property, IsSelected = true }); } filterProperty.OrderBy(p => p.Property); }
public virtual void CopyToList <TItem>(IEnumerable <TItem> source, IList <TItem> list) { if (source != null) { list?.Clear(); var itor = source.GetEnumerator(); while (itor.MoveNext()) { list?.Add(itor.Current); } } }
/// <summary> /// Cleans up memory when no longer needing this MonoPoolController and it's pooled instances. Destroys the pooled instances. /// </summary> public virtual void OnCleanUp() { CleanPoolInstances(); _onCreatedUnityEvent = null; _onSpawnUnityEvent = null; _onDespawnUnityEvent = null; _pool?.Clear(); _pool = null; _allInstances?.Clear(); _allInstances = null; }
internal int flags = 0; // bit field for timestamp and duration public Builder Reset() { traceId = null; parentId = null; id = null; kind = default(SpanKind); name = null; timestamp = 0L; duration = 0L; localEndpoint = default(Endpoint); remoteEndpoint = default(Endpoint); annotations?.Clear(); tags?.Clear(); flags = 0; return(this); }
/// <inheritdoc cref="IPlan"/> public int GetActions(IStateKey planStateKey, IList <IActionKey> actionKeys) { planData.CompletePlanningJobs(); actionKeys?.Clear(); int count = 0; var stateActionLookup = planData.PlanGraph.ActionLookup; if (stateActionLookup.TryGetFirstValue(Convert(planStateKey), out var actionKey, out var iterator)) { do { actionKeys?.Add(actionKey as IActionKey); count++; } while (stateActionLookup.TryGetNextValue(out actionKey, ref iterator)); } return(count); }
private void ClearInstances(bool dispose = false) { if (dispose && this.producers != null) { foreach (IMessageProducer p in producers) { p?.Dispose(); } } producers?.Clear(); if (dispose && this.consumers != null) { foreach (IMessageConsumer c in consumers) { c?.Dispose(); } } consumers?.Clear(); if (dispose && this.sessions != null) { foreach (ISession s in sessions) { s?.Close(); } } sessions?.Clear(); if (dispose && this.connections != null) { foreach (IConnection c in connections) { c?.Close(); } } connections?.Clear(); connectionFactories?.Clear(); providerFactory = null; }
/// <inheritdoc cref="IPlan"/> public int GetResultingStates(TStateKey planStateKey, TActionKey actionKey, IList <TStateKey> resultingPlanStateKeys) { planData.CompletePlanningJobs(); resultingPlanStateKeys?.Clear(); var count = 0; var stateActionPair = new StateActionPair <TStateKey, TActionKey>(planStateKey, actionKey); var resultingStateLookup = planData.PlanGraph.ResultingStateLookup; if (resultingStateLookup.TryGetFirstValue(stateActionPair, out var resultingState, out var iterator)) { do { resultingPlanStateKeys?.Add(resultingState); count++; } while (resultingStateLookup.TryGetNextValue(out resultingState, ref iterator)); } return(count); }
public static bool TryGet(IIrtRegression existing, IList <double> listIndependent, IList <double> listDependent, int minPoints, out IIrtRegression regression, IList <Tuple <double, double> > removedValues = null) { regression = null; removedValues?.Clear(); if (listIndependent.Count != listDependent.Count || listIndependent.Count < minPoints) { return(false); } var listX = new List <double>(listIndependent); var listY = new List <double>(listDependent); while (true) { regression = existing.ChangePoints(listX.ToArray(), listY.ToArray()); if (Accept(regression, minPoints) || listX.Count <= minPoints) { break; } var furthest = 0; var maxDistance = 0.0; for (var i = 0; i < listY.Count; i++) { var distance = Math.Abs(regression.GetY(listX[i]) - listY[i]); if (distance > maxDistance) { furthest = i; maxDistance = distance; } } removedValues?.Add(new Tuple <double, double>(listX[furthest], listY[furthest])); listX.RemoveAt(furthest); listY.RemoveAt(furthest); } return(Accept(regression, minPoints)); }
protected override void OnBindingContextChanged() { if (!(BindingContext is DynamicEntriesViewModel vm)) { return; } _entryViews?.Clear(); EntriesLayout.Children?.Clear(); foreach (var question in vm.Questions.OrderBy(q => q.Index)) { var entryViewModel = new DynamicEntryViewModel { Question = question }; var entryView = new DynamicEntryView { BindingContext = entryViewModel }; _entryViews?.Add(entryView); EntriesLayout.Children?.Add(entryView); } base.OnBindingContextChanged(); }
/// <summary>Make sure the GC knows to collect all the referenced objects.</summary> private void ClearReferenceFields() { foreach (FieldInfo field in this.GetType().GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance)) { Type fieldType = field.FieldType; if (typeof(IList).IsAssignableFrom(fieldType)) { IList list = field.GetValue(this) as IList; list?.Clear(); } if (typeof(IDictionary).IsAssignableFrom(fieldType)) { IDictionary dictionary = field.GetValue(this) as IDictionary; dictionary?.Clear(); } if (!fieldType.IsPrimitive) { field.SetValue(this, null); } } }
public void Reset() { _refs?.Clear(); }
private void ClearList() { list?.Clear(); }
void EmptyList(IList <int> lst) { lst?.Clear(); }
public static void DisposeAllItemsAndClearList <T>(IList <T> items) where T : IDisposable { DisposeAllItems(items); items?.Clear(); }
public override void DeleteBinding() { base.DeleteBinding(); _listOfValues?.Clear(); _listOfDisplayValues?.Clear(); }
private void GenerateContent() { Log.DebugFormat("GenerateContent called. Keyboard language is '{0}' and Keyboard type is '{1}'", Settings.Default.KeyboardAndDictionaryLanguage, Keyboard != null ? Keyboard.GetType() : null); //Clear out point to key map PointToKeyValueMap = null; mainWindow = mainWindow != null ? mainWindow : VisualAndLogicalTreeHelper.FindVisualParent <MainWindow>(this); //Clear any potential main window color overrides if (mainWindow != null) { keyFamily = mainWindow.KeyFamily; keyValueByGroup = mainWindow.KeyValueByGroup; overrideTimesByKey = mainWindow.OverrideTimesByKey; windowManipulationService = mainWindow.WindowManipulationService; mainWindow.BackgroundColourOverride = null; mainWindow.BorderBrushOverride = null; //Clear the dictionaries keyFamily?.Clear(); keyValueByGroup?.Clear(); overrideTimesByKey?.Clear(); //https://github.com/OptiKey/OptiKey/pull/715 //Fixing issue where navigating between dynamic and conversation keyboards causing sizing problems: //https://github.com/AdamRoden: "I think that because we use a dispatcher to apply the saved size and position, //we get in a situation where the main thread maximizes the window before it gets resized by the dispatcher thread. //My fix basically says, "don't try restoring the persisted state if we're navigating a maximized keyboard."" if (!(Keyboard is ViewModelKeyboards.DynamicKeyboard) && !(Keyboard is ViewModelKeyboards.ConversationAlpha1) && !(Keyboard is ViewModelKeyboards.ConversationAlpha2) && !(Keyboard is ViewModelKeyboards.ConversationConfirm) && !(Keyboard is ViewModelKeyboards.ConversationNumericAndSymbols)) { windowManipulationService.RestorePersistedState(); } } object newContent = ErrorContent; if (Keyboard is ViewModelKeyboards.Alpha1) { if (Settings.Default.UsingCommuniKateKeyboardLayout) { newContent = (object)new CommonViews.CommuniKate { DataContext = Keyboard }; } else { switch (Settings.Default.KeyboardAndDictionaryLanguage) { case Languages.CatalanSpain: newContent = new CatalanViews.Alpha1 { DataContext = Keyboard }; break; case Languages.CroatianCroatia: newContent = new CroatianViews.Alpha1 { DataContext = Keyboard }; break; case Languages.CzechCzechRepublic: newContent = new CzechViews.Alpha1 { DataContext = Keyboard }; break; case Languages.DanishDenmark: newContent = new DanishViews.Alpha1 { DataContext = Keyboard }; break; case Languages.DutchBelgium: newContent = new DutchViews.BelgiumAlpha { DataContext = Keyboard }; break; case Languages.DutchNetherlands: newContent = new DutchViews.NetherlandsAlpha { DataContext = Keyboard }; break; case Languages.FinnishFinland: newContent = new FinnishViews.Alpha1 { DataContext = Keyboard }; break; case Languages.FrenchCanada: newContent = new FrenchViews.CanadaAlpha1 { DataContext = Keyboard }; break; case Languages.FrenchFrance: newContent = new FrenchViews.FranceAlpha1 { DataContext = Keyboard }; break; case Languages.GeorgianGeorgia: newContent = Settings.Default.UseSimplifiedKeyboardLayout ? (object)new GeorgianViews.SimplifiedAlpha1 { DataContext = Keyboard } : new GeorgianViews.Alpha1 { DataContext = Keyboard }; break; case Languages.GermanGermany: newContent = Settings.Default.UseSimplifiedKeyboardLayout ? (object)new GermanViews.SimplifiedAlpha1 { DataContext = Keyboard } : Settings.Default.UseAlphabeticalKeyboardLayout ? (object)new GermanViews.AlphabeticalAlpha1 { DataContext = Keyboard } : new GermanViews.Alpha1 { DataContext = Keyboard }; break; case Languages.GreekGreece: newContent = new GreekViews.Alpha1 { DataContext = Keyboard }; break; case Languages.HebrewIsrael: newContent = Settings.Default.UseSimplifiedKeyboardLayout ? (object)new HebrewViews.SimplifiedAlpha1 { DataContext = Keyboard } : new HebrewViews.Alpha1 { DataContext = Keyboard }; break; case Languages.HindiIndia: newContent = new HindiViews.Alpha1 { DataContext = Keyboard }; break; case Languages.HungarianHungary: newContent = new HungarianViews.Alpha1 { DataContext = Keyboard }; break; case Languages.ItalianItaly: newContent = Settings.Default.UseAlphabeticalKeyboardLayout ? (object)new ItalianViews.AlphabeticalAlpha1 { DataContext = Keyboard } : new ItalianViews.Alpha1 { DataContext = Keyboard }; break; case Languages.JapaneseJapan: newContent = Settings.Default.UseSimplifiedKeyboardLayout ? (object)new JapaneseViews.SimplifiedAlpha1 { DataContext = Keyboard } : new JapaneseViews.Alpha1 { DataContext = Keyboard }; break; case Languages.KoreanKorea: newContent = new KoreanViews.Alpha1 { DataContext = Keyboard }; break; case Languages.PersianIran: newContent = new PersianViews.Alpha1 { DataContext = Keyboard }; break; case Languages.PolishPoland: newContent = new PolishViews.Alpha1 { DataContext = Keyboard }; break; case Languages.PortuguesePortugal: newContent = new PortugueseViews.Alpha1 { DataContext = Keyboard }; break; case Languages.RussianRussia: newContent = new RussianViews.Alpha1 { DataContext = Keyboard }; break; case Languages.SerbianSerbia: newContent = new SerbianViews.Alpha1 { DataContext = Keyboard }; break; case Languages.SlovakSlovakia: newContent = new SlovakViews.Alpha1 { DataContext = Keyboard }; break; case Languages.SlovenianSlovenia: newContent = new SlovenianViews.Alpha1 { DataContext = Keyboard }; break; case Languages.SpanishSpain: newContent = new SpanishViews.Alpha1 { DataContext = Keyboard }; break; case Languages.TurkishTurkey: newContent = Settings.Default.UseSimplifiedKeyboardLayout ? (object)new TurkishViews.SimplifiedAlpha1 { DataContext = Keyboard } : new TurkishViews.Alpha1 { DataContext = Keyboard }; break; case Languages.UkrainianUkraine: newContent = new UkrainianViews.Alpha1 { DataContext = Keyboard }; break; case Languages.UrduPakistan: newContent = new UrduViews.Alpha1 { DataContext = Keyboard }; break; default: newContent = Settings.Default.UseSimplifiedKeyboardLayout ? (object)new EnglishViews.SimplifiedAlpha1 { DataContext = Keyboard } : Settings.Default.UseAlphabeticalKeyboardLayout ? (object)new EnglishViews.AlphabeticalAlpha1 { DataContext = Keyboard } : new EnglishViews.Alpha1 { DataContext = Keyboard }; break; } } } else if (Keyboard is ViewModelKeyboards.Alpha2) { switch (Settings.Default.KeyboardAndDictionaryLanguage) { case Languages.HebrewIsrael: newContent = new HebrewViews.Alpha2 { DataContext = Keyboard }; break; case Languages.HindiIndia: newContent = new HindiViews.Alpha2 { DataContext = Keyboard }; break; case Languages.JapaneseJapan: newContent = Settings.Default.UseSimplifiedKeyboardLayout ? (object)new JapaneseViews.SimplifiedAlpha2 { DataContext = Keyboard } : new JapaneseViews.Alpha2 { DataContext = Keyboard }; break; case Languages.KoreanKorea: newContent = new KoreanViews.Alpha2 { DataContext = Keyboard }; break; case Languages.PersianIran: newContent = new PersianViews.Alpha2 { DataContext = Keyboard }; break; case Languages.UrduPakistan: newContent = new UrduViews.Alpha2 { DataContext = Keyboard }; break; } } //else if (Keyboard is ViewModelKeyboards.Alpha3) //{ // switch (Settings.Default.KeyboardAndDictionaryLanguage) // { // case Languages.PlaceholderForALanguageWith3AlphaKeyboards: // newContent = new PlaceholderForALanguageWith3AlphaKeyboardsViews.Alpha3 {DataContext = Keyboard}; // break; // } //} else if (Keyboard is ViewModelKeyboards.ConversationAlpha1) { if (Settings.Default.UsingCommuniKateKeyboardLayout) { newContent = (object)new CommonViews.CommuniKate { DataContext = Keyboard }; } else { switch (Settings.Default.KeyboardAndDictionaryLanguage) { case Languages.CatalanSpain: newContent = new CatalanViews.ConversationAlpha1 { DataContext = Keyboard }; break; case Languages.CroatianCroatia: newContent = new CroatianViews.ConversationAlpha1 { DataContext = Keyboard }; break; case Languages.CzechCzechRepublic: newContent = new CzechViews.ConversationAlpha1 { DataContext = Keyboard }; break; case Languages.DanishDenmark: newContent = new DanishViews.ConversationAlpha1 { DataContext = Keyboard }; break; case Languages.DutchBelgium: newContent = new DutchViews.BelgiumConversationAlpha1 { DataContext = Keyboard }; break; case Languages.DutchNetherlands: newContent = new DutchViews.NetherlandsConversationAlpha1 { DataContext = Keyboard }; break; case Languages.FinnishFinland: newContent = new FinnishViews.ConversationAlpha1 { DataContext = Keyboard }; break; case Languages.FrenchCanada: newContent = new FrenchViews.CanadaConversationAlpha1 { DataContext = Keyboard }; break; case Languages.FrenchFrance: newContent = new FrenchViews.FranceConversationAlpha1 { DataContext = Keyboard }; break; case Languages.GeorgianGeorgia: newContent = Settings.Default.UseSimplifiedKeyboardLayout ? (object)new GeorgianViews.SimplifiedConversationAlpha1 { DataContext = Keyboard } : new GeorgianViews.ConversationAlpha1 { DataContext = Keyboard }; break; case Languages.GermanGermany: newContent = Settings.Default.UseSimplifiedKeyboardLayout ? (object)new GermanViews.SimplifiedConversationAlpha1 { DataContext = Keyboard } : Settings.Default.UseAlphabeticalKeyboardLayout ? (object)new GermanViews.AlphabeticalConversationAlpha1 { DataContext = Keyboard } : new GermanViews.ConversationAlpha1 { DataContext = Keyboard }; break; case Languages.GreekGreece: newContent = new GreekViews.ConversationAlpha1 { DataContext = Keyboard }; break; case Languages.HebrewIsrael: newContent = Settings.Default.UseSimplifiedKeyboardLayout ? (object)new HebrewViews.SimplifiedConversationAlpha1 { DataContext = Keyboard } : new HebrewViews.ConversationAlpha1 { DataContext = Keyboard }; break; case Languages.HindiIndia: newContent = new HindiViews.ConversationAlpha1 { DataContext = Keyboard }; break; case Languages.HungarianHungary: newContent = new HungarianViews.ConversationAlpha1 { DataContext = Keyboard }; break; case Languages.ItalianItaly: newContent = Settings.Default.UseAlphabeticalKeyboardLayout ? (object)new ItalianViews.AlphabeticalConversationAlpha1 { DataContext = Keyboard } : new ItalianViews.ConversationAlpha1 { DataContext = Keyboard }; break; case Languages.JapaneseJapan: newContent = new JapaneseViews.ConversationAlpha1 { DataContext = Keyboard }; break; case Languages.KoreanKorea: newContent = new KoreanViews.ConversationAlpha1 { DataContext = Keyboard }; break; case Languages.PersianIran: newContent = new PersianViews.ConversationAlpha1 { DataContext = Keyboard }; break; case Languages.PolishPoland: newContent = new PolishViews.ConversationAlpha1 { DataContext = Keyboard }; break; case Languages.PortuguesePortugal: newContent = new PortugueseViews.ConversationAlpha1 { DataContext = Keyboard }; break; case Languages.RussianRussia: newContent = new RussianViews.ConversationAlpha1 { DataContext = Keyboard }; break; case Languages.SerbianSerbia: newContent = new SerbianViews.ConversationAlpha1 { DataContext = Keyboard }; break; case Languages.SlovakSlovakia: newContent = new SlovakViews.ConversationAlpha1 { DataContext = Keyboard }; break; case Languages.SlovenianSlovenia: newContent = new SlovenianViews.ConversationAlpha1 { DataContext = Keyboard }; break; case Languages.SpanishSpain: newContent = new SpanishViews.ConversationAlpha1 { DataContext = Keyboard }; break; case Languages.TurkishTurkey: newContent = Settings.Default.UseSimplifiedKeyboardLayout ? (object)new TurkishViews.SimplifiedConversationAlpha1 { DataContext = Keyboard } : new TurkishViews.ConversationAlpha1 { DataContext = Keyboard }; break; case Languages.UkrainianUkraine: newContent = new UkrainianViews.ConversationAlpha1 { DataContext = Keyboard }; break; case Languages.UrduPakistan: newContent = new UrduViews.ConversationAlpha1 { DataContext = Keyboard }; break; default: newContent = Settings.Default.UseSimplifiedKeyboardLayout ? (object)new EnglishViews.SimplifiedConversationAlpha1 { DataContext = Keyboard } : Settings.Default.UseAlphabeticalKeyboardLayout ? (object)new EnglishViews.AlphabeticalConversationAlpha1 { DataContext = Keyboard } : new EnglishViews.ConversationAlpha1 { DataContext = Keyboard }; break; } } } else if (Keyboard is ViewModelKeyboards.ConversationAlpha2) { switch (Settings.Default.KeyboardAndDictionaryLanguage) { case Languages.HindiIndia: newContent = new HindiViews.ConversationAlpha2 { DataContext = Keyboard }; break; case Languages.JapaneseJapan: newContent = new JapaneseViews.ConversationAlpha2 { DataContext = Keyboard }; break; case Languages.KoreanKorea: newContent = new KoreanViews.ConversationAlpha2 { DataContext = Keyboard }; break; case Languages.PersianIran: newContent = new PersianViews.ConversationAlpha2 { DataContext = Keyboard }; break; case Languages.UrduPakistan: newContent = new UrduViews.ConversationAlpha2 { DataContext = Keyboard }; break; } } //else if (Keyboard is ViewModelKeyboards.ConversationAlpha3) //{ // switch (Settings.Default.KeyboardAndDictionaryLanguage) // { // case Languages.PlaceholderForALanguageWith3AlphaKeyboards: // newContent = new PlaceholderForALanguageWith3AlphaKeyboardsViews.ConversationAlpha3 { DataContext = Keyboard }; // break; // } //} else if (Keyboard is ViewModelKeyboards.ConversationConfirm) { newContent = new CommonViews.ConversationConfirm { DataContext = Keyboard }; } else if (Keyboard is ViewModelKeyboards.ConversationNumericAndSymbols) { switch (Settings.Default.KeyboardAndDictionaryLanguage) { case Languages.HindiIndia: newContent = new HindiViews.ConversationNumericAndSymbols { DataContext = Keyboard }; break; case Languages.PersianIran: newContent = new PersianViews.ConversationNumericAndSymbols { DataContext = Keyboard }; break; case Languages.UrduPakistan: newContent = new UrduViews.ConversationNumericAndSymbols { DataContext = Keyboard }; break; default: newContent = new CommonViews.ConversationNumericAndSymbols { DataContext = Keyboard }; break; } } else if (Keyboard is ViewModelKeyboards.Currencies1) { newContent = new CommonViews.Currencies1 { DataContext = Keyboard }; } else if (Keyboard is ViewModelKeyboards.Currencies2) { newContent = new CommonViews.Currencies2 { DataContext = Keyboard }; } else if (Keyboard is ViewModelKeyboards.Diacritics1) { newContent = new CommonViews.Diacritics1 { DataContext = Keyboard }; } else if (Keyboard is ViewModelKeyboards.Diacritics2) { newContent = new CommonViews.Diacritics2 { DataContext = Keyboard }; } else if (Keyboard is ViewModelKeyboards.Diacritics3) { newContent = new CommonViews.Diacritics3 { DataContext = Keyboard }; } else if (Keyboard is ViewModelKeyboards.Language) { newContent = new CommonViews.Language { DataContext = Keyboard }; } else if (Keyboard is ViewModelKeyboards.Voice) { var voice = Keyboard as ViewModelKeyboards.Voice; // Since the Voice keyboard's view-model is in charge of creating the keys instead of the // view, we need to make sure any localized text is up-to-date with the current UI language. voice.LocalizeKeys(); newContent = new CommonViews.Voice { DataContext = Keyboard }; } else if (Keyboard is ViewModelKeyboards.Menu) { newContent = new CommonViews.Menu { DataContext = Keyboard }; } else if (Keyboard is ViewModelKeyboards.Minimised) { newContent = new CommonViews.Minimised { DataContext = Keyboard }; } else if (Keyboard is ViewModelKeyboards.Mouse) { newContent = new CommonViews.Mouse { DataContext = Keyboard }; } else if (Keyboard is ViewModelKeyboards.NumericAndSymbols1) { switch (Settings.Default.KeyboardAndDictionaryLanguage) { case Languages.HindiIndia: newContent = new HindiViews.NumericAndSymbols1 { DataContext = Keyboard }; break; case Languages.PersianIran: newContent = new PersianViews.NumericAndSymbols1 { DataContext = Keyboard }; break; case Languages.UrduPakistan: newContent = new UrduViews.NumericAndSymbols1 { DataContext = Keyboard }; break; default: newContent = new CommonViews.NumericAndSymbols1 { DataContext = Keyboard }; break; } } else if (Keyboard is ViewModelKeyboards.NumericAndSymbols2) { switch (Settings.Default.KeyboardAndDictionaryLanguage) { case Languages.HindiIndia: newContent = new HindiViews.NumericAndSymbols2 { DataContext = Keyboard }; break; case Languages.PersianIran: newContent = new PersianViews.NumericAndSymbols2 { DataContext = Keyboard }; break; case Languages.UrduPakistan: newContent = new UrduViews.NumericAndSymbols2 { DataContext = Keyboard }; break; default: newContent = new CommonViews.NumericAndSymbols2 { DataContext = Keyboard }; break; } } else if (Keyboard is ViewModelKeyboards.NumericAndSymbols3) { switch (Settings.Default.KeyboardAndDictionaryLanguage) { case Languages.HindiIndia: newContent = new HindiViews.NumericAndSymbols3 { DataContext = Keyboard }; break; case Languages.PersianIran: newContent = new PersianViews.NumericAndSymbols3 { DataContext = Keyboard }; break; case Languages.UrduPakistan: newContent = new UrduViews.NumericAndSymbols3 { DataContext = Keyboard }; break; default: newContent = new CommonViews.NumericAndSymbols3 { DataContext = Keyboard }; break; } } else if (Keyboard is ViewModelKeyboards.PhysicalKeys) { newContent = new CommonViews.PhysicalKeys { DataContext = Keyboard }; } else if (Keyboard is ViewModelKeyboards.SizeAndPosition) { newContent = new CommonViews.SizeAndPosition { DataContext = Keyboard }; } else if (Keyboard is ViewModelKeyboards.WebBrowsing) { newContent = new CommonViews.WebBrowsing { DataContext = Keyboard }; } else if (Keyboard is ViewModelKeyboards.YesNoQuestion) { newContent = new CommonViews.YesNoQuestion { DataContext = Keyboard }; } else if (Keyboard is ViewModelKeyboards.DynamicKeyboard) { var kb = Keyboard as ViewModelKeyboards.DynamicKeyboard; newContent = new CommonViews.DynamicKeyboard(mainWindow, kb.Link, keyFamily, keyValueByGroup, overrideTimesByKey, windowManipulationService) { DataContext = Keyboard }; } else if (Keyboard is ViewModelKeyboards.DynamicKeyboardSelector) { var kb = Keyboard as ViewModelKeyboards.DynamicKeyboardSelector; newContent = new CommonViews.DynamicKeyboardSelector(kb.PageIndex) { DataContext = Keyboard }; } Content = newContent; }
public static void AddRangeOverride <TKey>(this IList <TKey> list, IList <TKey> listToAdd) { list?.Clear(); listToAdd.ForEach(x => list.Add(x)); }
public void ClearUp() { _repositoryMock = null; _messageService = null; _data?.Clear(); }