public Solution(IModel model, IProblemData problemData) : base(model, problemData) { Add(new Result(TrainingSharpeRatioResultName, "Share ratio of the signals of the model on the training partition", new DoubleValue())); Add(new Result(TestSharpeRatioResultName, "Sharpe ratio of the signals of the model on the test partition", new DoubleValue())); Add(new Result(TrainingProfitResultName, "Profit of the model on the training partition", new DoubleValue())); Add(new Result(TestProfitResultName, "Profit of the model on the test partition", new DoubleValue())); }
protected virtual void DeclareQueue(IModel channel) { if (this.DispatchOnly) return; var declarationArgs = new Dictionary<string, object>(); if (this.DeadLetterExchange != null) declarationArgs[DeadLetterExchangeDeclaration] = this.DeadLetterExchange.ExchangeName; if (this.Clustered) declarationArgs[ClusteredQueueDeclaration] = ReplicateToAllNodes; var inputQueue = this.InputQueue; if (this.RandomInputQueue) inputQueue = string.Empty; var declaration = channel.QueueDeclare( inputQueue, this.DurableQueue, this.ExclusiveQueue, this.AutoDelete, declarationArgs); if (declaration != null) this.InputQueue = declaration.QueueName; if (!this.ReturnAddressSpecified) this.ReturnAddress = new Uri(DefaultReturnAddressFormat.FormatWith(this.InputQueue)); if (this.PurgeOnStartup) channel.QueuePurge(this.InputQueue); channel.BasicQos(0, (ushort)this.ChannelBuffer, false); }
/// <summary> /// Initializes a new instance of the <see cref="T:SimpleShapeBase"/> class. /// </summary> /// <param name="model">the <see cref="IModel"/></param> public SimpleShapeBase(IModel model) : base(model) { mTextRectangle = Rectangle; mTextRectangle.Inflate(-TextRectangleInflation, -TextRectangleInflation); }
public virtual IBasicProperties Create(IModel channel, MessageProperties properties) { var basicProperties = channel.CreateBasicProperties(); if(!string.IsNullOrWhiteSpace(properties.MessageId)) { basicProperties.MessageId = properties.MessageId; } if(!string.IsNullOrWhiteSpace(properties.CorrelationId)) { basicProperties.CorrelationId = properties.CorrelationId; } if(!string.IsNullOrWhiteSpace(properties.ContentType)) { basicProperties.ContentType = properties.ContentType; } if(!string.IsNullOrWhiteSpace(properties.ContentEncoding)) { basicProperties.ContentEncoding = properties.ContentEncoding; } basicProperties.DeliveryMode = (byte) properties.DeliveryMode; if(properties.Headers.Keys.Any()) { basicProperties.Headers = new Dictionary<object, object>(); foreach(var key in properties.Headers.Keys) { basicProperties.Headers.Add(key, properties.Headers[key]); } } return basicProperties; }
private bool DefaultSequenceUsed(IModel model) => model != null && model.Npgsql().DefaultSequenceName == null && (model.Npgsql().ValueGenerationStrategy == NpgsqlValueGenerationStrategy.Sequence || model.EntityTypes.SelectMany(t => t.GetProperties()).Any( p => p.Npgsql().ValueGenerationStrategy == NpgsqlValueGenerationStrategy.Sequence && p.Npgsql().SequenceName == null));
public Telegraph() { var connectionFactory = new ConnectionFactory { HostName = "localhost", VirtualHost = "test" }; _connection = connectionFactory.CreateConnection(); _channel = _connection.CreateModel(); _consumer = new QueueingBasicConsumer(_channel); }
public TBankData saveBankInformation(IModel model) { // try // { // bankModel = (BankModel)model; // bankEntity.BankName = bankModel.BankName; // bankEntity.Branch = bankModel.BankBranch; // bankEntity.AccountNo = bankModel.BankAccountNumber; // bankEntity.IFSC_CODE = bankModel.IFSCCode; // bankEntity.MICR_CODE = bankModel.MICRCode; // _dataContext.BankInfos.InsertOnSubmit(bankEntity); // _dataContext.SubmitChanges(); // tbankData.SuccessCode = SuccessCodes.RECORD_SAVED_SUCCESSFULLY; // tbankData.SuccessMessage = SuccessMessages.RECORD_SAVED_SUCCESSFULLY_MSG; // return tbankData; // } // catch (Exception exp) // { // tbankData.ErrorCode = ErrorCodes.DATA_ACCESS_ERROR; // tbankData.ErrorMessage = exp.StackTrace; // return tbankData; // } return null; }
public override void ColumnDefinition( string schema, string table, string name, string type, bool nullable, object defaultValue, string defaultValueSql, string computedColumnSql, IAnnotatable annotatable, IModel model, SqlBatchBuilder builder) { base.ColumnDefinition( schema, table, name, type, nullable, defaultValue, defaultValueSql, computedColumnSql, annotatable, model, builder); var columnAnnotation = annotatable as Annotatable; var inlinePk = columnAnnotation?.FindAnnotation(SqliteAnnotationNames.Prefix + SqliteAnnotationNames.InlinePrimaryKey); if (inlinePk != null && (bool)inlinePk.Value) { builder.Append(" PRIMARY KEY"); var autoincrement = columnAnnotation.FindAnnotation(SqliteAnnotationNames.Prefix + SqliteAnnotationNames.Autoincrement); if (autoincrement != null && (bool)autoincrement.Value) { builder.Append(" AUTOINCREMENT"); } } }
/// <summary> /// Initializes a new instance of the NameField class with the specified id, parent node and /// references. /// </summary> /// <param name="id">The id of the new NameField.</param> /// <param name="elementManager">A reference to the ElementManager.</param> /// <param name="model">A reference to the Model.</param> /// <param name="parentNode">A reference to the parent node of the NameField.</param> public NameField(String id, ElementManager elementManager, IModel model, IVisualNode parentNode) { _id = id; _elementManager = elementManager; _model = model; _parentNode = parentNode; }
/// <summary> /// Call the specified event on the specified model. /// </summary> /// <param name="model">The model to call the event on</param> /// <param name="eventName">The name of the event</param> /// <param name="args">The event arguments. Can be null</param> public static void CallEventHandler(IModel model, string eventName, object[] args) { foreach (EventSubscriber subscriber in FindEventSubscribers(eventName, model)) { subscriber.MethodInfo.Invoke(model, args); } }
internal BrokerWrapper(IConnectionBuilder connectionBuilder, IModel model, EnvironmentConfiguration configuration) : base(configuration, connectionBuilder) { _model = model; }
public override List<SqlParameter> CreateInsertParameters(IModel obj, ref SqlParameter returnValue) { FinBusInvAllotDetail inv_finbusinvallotdetail = (FinBusInvAllotDetail)obj; List<SqlParameter> paras = new List<SqlParameter>(); returnValue.Direction = ParameterDirection.Output; returnValue.SqlDbType = SqlDbType.Int; returnValue.ParameterName = "@DetailId"; returnValue.Size = 4; paras.Add(returnValue); SqlParameter allotidpara = new SqlParameter("@AllotId", SqlDbType.Int, 4); allotidpara.Value = inv_finbusinvallotdetail.AllotId; paras.Add(allotidpara); SqlParameter businessinvoiceidpara = new SqlParameter("@BusinessInvoiceId", SqlDbType.Int, 4); businessinvoiceidpara.Value = inv_finbusinvallotdetail.BusinessInvoiceId; paras.Add(businessinvoiceidpara); SqlParameter financeinvoiceidpara = new SqlParameter("@FinanceInvoiceId", SqlDbType.Int, 4); financeinvoiceidpara.Value = inv_finbusinvallotdetail.FinanceInvoiceId; paras.Add(financeinvoiceidpara); SqlParameter allotbalapara = new SqlParameter("@AllotBala", SqlDbType.Decimal, 9); allotbalapara.Value = inv_finbusinvallotdetail.AllotBala; paras.Add(allotbalapara); SqlParameter detailstatuspara = new SqlParameter("@DetailStatus", SqlDbType.Int, 4); detailstatuspara.Value = (int)Common.StatusEnum.已生效; paras.Add(detailstatuspara); return paras; }
public void Disconnect() { if (_model != null) { lock (_model) { _model.Close(200, "Goodbye"); _model.Dispose(); } _model = null; } if (_connection != null) { lock (_connection) { _connection.Close(); _connection.Dispose(); } _connection = null; } if (_connectionFactory != null) { lock (_connectionFactory) { _connectionFactory = null; } } }
public RabbitMQMessageBus(IDependencyResolver resolver, string rabbitMqExchangeName, IModel rabbitMqChannel) : base(resolver) { _rabbitmqchannel = rabbitMqChannel; _rabbitmqExchangeName = rabbitMqExchangeName; EnsureConnection(); }
public override List<SqlParameter> CreateInsertParameters(IModel obj, ref SqlParameter returnValue) { AuditEmp wf_auditemp = (AuditEmp)obj; List<SqlParameter> paras = new List<SqlParameter>(); returnValue.Direction = ParameterDirection.Output; returnValue.SqlDbType = SqlDbType.Int; returnValue.ParameterName = "@AuditEmpId"; returnValue.Size = 4; paras.Add(returnValue); SqlParameter auditemptypepara = new SqlParameter("@AuditEmpType", SqlDbType.Int, 4); auditemptypepara.Value = wf_auditemp.AuditEmpType; paras.Add(auditemptypepara); SqlParameter valueidpara = new SqlParameter("@ValueId", SqlDbType.Int, 4); valueidpara.Value = wf_auditemp.ValueId; paras.Add(valueidpara); SqlParameter auditempstatuspara = new SqlParameter("@AuditEmpStatus", SqlDbType.Int, 4); auditempstatuspara.Value = wf_auditemp.AuditEmpStatus; paras.Add(auditempstatuspara); SqlParameter creatoridpara = new SqlParameter("@CreatorId", SqlDbType.Int, 4); creatoridpara.Value = obj.CreatorId; paras.Add(creatoridpara); return paras; }
protected void EnsureNoShadowKeys(IModel model) { foreach (var entityType in model.EntityTypes) { foreach (var key in entityType.GetKeys()) { if (key.Properties.Any(p => p.IsShadowProperty)) { string message; var referencingFk = model.GetReferencingForeignKeys(key).FirstOrDefault(); if (referencingFk != null) { message = Strings.ReferencedShadowKey( Property.Format(key.Properties), entityType.Name, Property.Format(key.Properties.Where(p => p.IsShadowProperty)), Property.Format(referencingFk.Properties), referencingFk.DeclaringEntityType.Name); } else { message = Strings.ShadowKey( Property.Format(key.Properties), entityType.Name, Property.Format(key.Properties.Where(p => p.IsShadowProperty))); } ShowWarning(message); } } } }
public override List<SqlParameter> CreateInsertParameters(IModel obj, ref SqlParameter returnValue) { CorpDept corpdept = (CorpDept)obj; List<SqlParameter> paras = new List<SqlParameter>(); returnValue.Direction = ParameterDirection.Output; returnValue.SqlDbType = SqlDbType.Int; returnValue.ParameterName = "@CorpEmpId"; returnValue.Size = 4; paras.Add(returnValue); SqlParameter deptidpara = new SqlParameter("@DeptId", SqlDbType.Int, 4); deptidpara.Value = corpdept.DeptId; paras.Add(deptidpara); SqlParameter corpidpara = new SqlParameter("@CorpId", SqlDbType.Int, 4); corpidpara.Value = corpdept.CorpId; paras.Add(corpidpara); SqlParameter refstatuspara = new SqlParameter("@RefStatus", SqlDbType.Int, 4); refstatuspara.Value = corpdept.RefStatus; paras.Add(refstatuspara); return paras; }
/// <summary> /// Выполняет проверку отношения переходов модели <paramref name = "model" /> /// на тотальность. /// </summary> /// <remarks> /// Отношение переходов модели называется <i>тотальным</i>, если /// из каждого состояния существует переход в некоторое состояние. /// </remarks> /// <param name = "model">Модель.</param> /// <exception cref = "ArgumentNullException"><paramref name = "model" /> является <c>null</c>.</exception> /// <returns><c>true</c>, если отношение переходов тотально.</returns> public static bool Check(IModel model) { if (model == null) throw new ArgumentNullException ("model"); return model.States.All (s => model.Transitions (s).Count != 0); }
private IEnumerable<IAnnotatable> GetAnnotatables(IModel model) { yield return model; foreach (var entityType in model.EntityTypes) { yield return entityType; foreach (var property in entityType.GetDeclaredProperties()) { yield return property; } foreach (var key in entityType.GetDeclaredKeys()) { yield return key; } foreach (var foreignKey in entityType.GetDeclaredForeignKeys()) { yield return foreignKey; } foreach (var index in entityType.GetDeclaredIndexes()) { yield return index; } } }
public SmallObject(IModel model) : base(model) { setTextFormat(); setTextFont(); setRectangleSize(); }
public MigrationsScaffolder( [NotNull] DbContext context, [NotNull] IModel model, [NotNull] IMigrationsAssembly migrationsAssembly, [NotNull] IMigrationsModelDiffer modelDiffer, [NotNull] IMigrationsIdGenerator idGenerator, [NotNull] MigrationsCodeGenerator migrationCodeGenerator, [NotNull] IHistoryRepository historyRepository, [NotNull] ILoggerFactory loggerFactory, [NotNull] IDatabaseProviderServices providerServices) { Check.NotNull(context, nameof(context)); Check.NotNull(model, nameof(model)); Check.NotNull(migrationsAssembly, nameof(migrationsAssembly)); Check.NotNull(modelDiffer, nameof(modelDiffer)); Check.NotNull(idGenerator, nameof(idGenerator)); Check.NotNull(migrationCodeGenerator, nameof(migrationCodeGenerator)); Check.NotNull(historyRepository, nameof(historyRepository)); Check.NotNull(loggerFactory, nameof(loggerFactory)); Check.NotNull(providerServices, nameof(providerServices)); _contextType = context.GetType(); _model = model; _migrationsAssembly = migrationsAssembly; _modelDiffer = modelDiffer; _idGenerator = idGenerator; _migrationCodeGenerator = migrationCodeGenerator; _historyRepository = historyRepository; _logger = new LazyRef<ILogger>(() => loggerFactory.CreateCommandsLogger()); _activeProvider = providerServices.InvariantName; }
public override List<SqlParameter> CreateInsertParameters(IModel obj, ref SqlParameter returnValue) { FinanceBusinessInvoice inv_financebusinessinvoice_ref = (FinanceBusinessInvoice)obj; List<SqlParameter> paras = new List<SqlParameter>(); returnValue.Direction = ParameterDirection.Output; returnValue.SqlDbType = SqlDbType.Int; returnValue.ParameterName = "@RefId"; returnValue.Size = 4; paras.Add(returnValue); SqlParameter businessinvoiceidpara = new SqlParameter("@BusinessInvoiceId", SqlDbType.Int, 4); businessinvoiceidpara.Value = inv_financebusinessinvoice_ref.BusinessInvoiceId; paras.Add(businessinvoiceidpara); SqlParameter financeinvoiceidpara = new SqlParameter("@FinanceInvoiceId", SqlDbType.Int, 4); financeinvoiceidpara.Value = inv_financebusinessinvoice_ref.FinanceInvoiceId; paras.Add(financeinvoiceidpara); SqlParameter balapara = new SqlParameter("@Bala", SqlDbType.Decimal, 9); balapara.Value = inv_financebusinessinvoice_ref.Bala; paras.Add(balapara); return paras; }
public LogInDialogViewModel(IModel model) { _model = model; _oAuth2Client = new OAuth2Client(); InitializeModelEvents(); InitializeRelayCommands(); }
public MainForm() { InitializeComponent(); model = new Model.Model(this); controller = new Controller.Controller(this, model); model.addObserver(this); }
internal AmqpModelContainer(IModel channel, ChannelFlags flags, AmqpChannelPooler source) { Channel = channel; Flags = flags; Source = source; Created = Environment.TickCount; }
/// <summary>Adds a new model (as specified by the xml node) to the specified parent.</summary> /// <param name="parent">The parent to add the model to</param> /// <param name="node">The XML representing the new model</param> /// <returns>The newly created model.</returns> public static IModel Add(IModel parent, XmlNode node) { IModel modelToAdd = XmlUtilities.Deserialise(node, Assembly.GetExecutingAssembly()) as Model; // Get all child models List<IModel> modelsToNotify = Apsim.ChildrenRecursively(modelToAdd); // Call deserialised in all models. object[] args = new object[] { true }; CallEventHandler(modelToAdd, "Deserialised", args); foreach (IModel modelToNotify in modelsToNotify) CallEventHandler(modelToNotify, "Deserialised", args); // Corrently parent all models. Add(parent, modelToAdd); // Ensure the model name is valid. Apsim.EnsureNameIsUnique(modelToAdd); // Call OnLoaded Apsim.CallEventHandler(modelToAdd, "Loaded", null); foreach (IModel child in modelsToNotify) Apsim.CallEventHandler(child, "Loaded", null); Locator(parent).Clear(); return modelToAdd; }
//Create the connection, Model and Exchange(if one is required) public virtual bool ConnectToRabbitMQ() { try { Dictionary<string, Service[]> connParams = JsonConvert.DeserializeObject<Dictionary<string, Service[]>>(vcapConn); var connectionFactory = new ConnectionFactory(); if (connParams.ContainsKey("rabbitmq-2.4")) { Service s = connParams["rabbitmq-2.4"][0]; connectionFactory.HostName = s.Credential.Hostname; connectionFactory.UserName = s.Credential.UserName; connectionFactory.Password = s.Credential.Password; connectionFactory.Port = s.Credential.Port; connectionFactory.VirtualHost = s.Credential.VHost; } Connection = connectionFactory.CreateConnection(); Model = Connection.CreateModel(); bool durable = true; if (!String.IsNullOrEmpty(Exchange)) Model.ExchangeDeclare(Exchange, ExchangeTypeName, durable); QueueName = Model.QueueDeclare ("incidentQueue", true, false, false, null); Model.QueueBind(QueueName, Exchange,""); return true; } catch (BrokerUnreachableException e) { return false; } }
public static IDependencyResolver UseRabbitMQ(this IDependencyResolver resolver, string rabbitMqExchangeName, IModel rabbitMqChannel) { var bus = new Lazy<RabbitMQMessageBus>(() => new RabbitMQMessageBus(resolver, rabbitMqExchangeName, rabbitMqChannel)); resolver.Register(typeof(IMessageBus), () => bus.Value); return resolver; }
public override List<SqlParameter> CreateUpdateParameters(IModel obj) { SmsRead sm_smsread = (SmsRead)obj; List<SqlParameter> paras = new List<SqlParameter>(); SqlParameter smsreadidpara = new SqlParameter("@SmsReadId", SqlDbType.Int, 4); smsreadidpara.Value = sm_smsread.SmsReadId; paras.Add(smsreadidpara); SqlParameter smsidpara = new SqlParameter("@SmsId", SqlDbType.Int, 4); smsidpara.Value = sm_smsread.SmsId; paras.Add(smsidpara); SqlParameter empidpara = new SqlParameter("@EmpId", SqlDbType.Int, 4); empidpara.Value = sm_smsread.EmpId; paras.Add(empidpara); SqlParameter lastreadtimepara = new SqlParameter("@LastReadTime", SqlDbType.DateTime, 8); lastreadtimepara.Value = sm_smsread.LastReadTime; paras.Add(lastreadtimepara); SqlParameter readstatuspara = new SqlParameter("@ReadStatus", SqlDbType.Int, 4); readstatuspara.Value = sm_smsread.ReadStatus; paras.Add(readstatuspara); return paras; }
public int Update(Common.DataContext ctx, IModel.BaseTable baseTable) { int rel = 0; rel = dal.Update(ctx, baseTable); return rel; }
/// <summary> /// Create and apply the migration for relational database<br/> /// 创建并迁移关系数据库中的数据库<br/> /// See: https://github.com/aspnet/EntityFramework/blob/master/src/Microsoft.EntityFrameworkCore.Relational/Storage/RelationalDatabaseCreator.cs /// </summary> /// <param name="context">Entity Framework Core database context</param> /// <param name="initialModel">Initial model, only contains migration history</param> protected void MigrateRelationalDatabase(DbContext context, IModel initialModel) { var serviceProvider = ((IInfrastructure <IServiceProvider>)context).Instance; // Get the last migration model var lastModel = initialModel; var histories = context.Set <EFCoreMigrationHistory>(); var lastMigration = histories.OrderByDescending(h => h.Revision).FirstOrDefault(); if (lastMigration != null) { // Remove old snapshot code and assembly var tempPath = Path.GetTempPath(); foreach (var file in Directory.EnumerateFiles( tempPath, ModelSnapshotFilePrefix + "*").ToList()) { try { File.Delete(file); } catch { /* Ignore error */ } } // Write snapshot code to temp directory and compile it to assembly var assemblyName = ModelSnapshotFilePrefix + DateTime.UtcNow.Ticks; var codePath = Path.Combine(tempPath, assemblyName + ".cs"); var assemblyPath = Path.Combine(tempPath, assemblyName + ".dll"); var compileService = Application.Ioc.Resolve <ICompilerService>(); var assemblyLoader = Application.Ioc.Resolve <IAssemblyLoader>(); File.WriteAllText(codePath, lastMigration.Model); compileService.Compile(new[] { codePath }, assemblyName, assemblyPath); // Load assembly and create the snapshot instance var assembly = assemblyLoader.LoadFile(assemblyPath); var snapshot = (ModelSnapshot)Activator.CreateInstance( assembly.GetTypes().First(t => typeof(ModelSnapshot).IsAssignableFrom(t))); lastModel = snapshot.Model; } // Compare with the newest model var modelDiffer = serviceProvider.GetService <IMigrationsModelDiffer>(); var sqlGenerator = serviceProvider.GetService <IMigrationsSqlGenerator>(); var commandExecutor = serviceProvider.GetService <IMigrationCommandExecutor>(); var operations = modelDiffer.GetDifferences(lastModel, context.Model); if (operations.Count <= 0) { // There no difference return; } // There some difference, we need perform the migration var commands = sqlGenerator.Generate(operations, context.Model); var connection = serviceProvider.GetService <IRelationalConnection>(); var typeMappingSource = serviceProvider.GetService <IRelationalTypeMappingSource>(); // Take a snapshot to the newest model var codeHelper = new CSharpHelper(typeMappingSource); var generator = new CSharpMigrationsGenerator( new MigrationsCodeGeneratorDependencies(), new CSharpMigrationsGeneratorDependencies( codeHelper, new CSharpMigrationOperationGenerator( new CSharpMigrationOperationGeneratorDependencies(codeHelper)), new CSharpSnapshotGenerator(new CSharpSnapshotGeneratorDependencies(codeHelper)))); var modelSnapshot = generator.GenerateSnapshot( ModelSnapshotNamespace, context.GetType(), ModelSnapshotClassPrefix + DateTime.UtcNow.Ticks, context.Model); // Insert the history first, if migration failed, delete it var history = new EFCoreMigrationHistory(modelSnapshot); histories.Add(history); context.SaveChanges(); try { // Execute migration commands commandExecutor.ExecuteNonQuery(commands, connection); } catch { histories.Remove(history); context.SaveChanges(); throw; } }
public ProjectDetailsForm(string projID, IModel _md) { InitializeComponent(); this.projectID = projID; this._model = _md; }
public MessageMonitorConsumer(IModel model, IMessageHelper messageHelper, Action <SerializedBusMessage> monitor, IErrorSubscriber errorSubscriber) : base(model) { _messageHelper = messageHelper; _monitor = monitor; _errorSubscriber = errorSubscriber; }
protected override void Generate([NotNull] DropPrimaryKeyOperation operation, [CanBeNull] IModel model, [NotNull] MigrationCommandListBuilder builder) { Check.NotNull(operation, nameof(operation)); Check.NotNull(builder, nameof(builder)); builder .Append("ALTER TABLE ") .Append(Dependencies.SqlGenerationHelper.DelimitIdentifier(operation.Table, operation.Schema)) .Append(" DROP CONSTRAINT ") .Append(operation.Name); EndStatement(builder); }
/// <summary> /// Construct an instance for writing. See <see cref="BasicMessageBuilder"/>. /// </summary> public MapMessageBuilder(IModel model, int initialAccumulatorSize) : base(model, initialAccumulatorSize) { Body = new Dictionary <string, object>(); }
public IfcSurfaceOfRevolutions(IModel model) { this._model = model; }
public unsafe void resourceTree_SelectionChanged(object sender, EventArgs e) { audioPlaybackPanel1.TargetSource = null; animEditControl.TargetSequence = null; texAnimEditControl.TargetSequence = null; shpAnimEditControl.TargetSequence = null; msBinEditor1.CurrentNode = null; //soundPackControl1.TargetNode = null; clrControl.ColorSource = null; visEditor.TargetNode = null; scN0CameraEditControl1.TargetSequence = null; scN0LightEditControl1.TargetSequence = null; scN0FogEditControl1.TargetSequence = null; texCoordControl1.TargetNode = null; ppcDisassembler1.SetTarget(null, 0, null); modelPanel1.ClearAll(); mdL0ObjectControl1.SetTarget(null); if (hexBox1.ByteProvider != null) { ((Be.Windows.Forms.DynamicFileByteProvider)hexBox1.ByteProvider).Dispose(); } Control newControl = null; Control newControl2 = null; BaseWrapper w; ResourceNode node = null; bool disable2nd = false; if ((resourceTree.SelectedNode is BaseWrapper) && ((node = (w = resourceTree.SelectedNode as BaseWrapper).ResourceNode) != null)) { propertyGrid1.SelectedObject = node; #if DEBUG if (node is IBufferNode) { IBufferNode d = node as IBufferNode; if (d.IsValid()) { hexBox1.ByteProvider = new Be.Windows.Forms.DynamicFileByteProvider(new UnmanagedMemoryStream( (byte *)d.GetAddress(), d.GetLength(), d.GetLength(), FileAccess.ReadWrite)) { _supportsInsDel = false }; newControl = hexBox1; } } else #endif if (node is RSARGroupNode) { rsarGroupEditor.LoadGroup(node as RSARGroupNode); newControl = rsarGroupEditor; } else if (node is RELMethodNode) { ppcDisassembler1.SetTarget((RELMethodNode)node); newControl = ppcDisassembler1; } else if (node is IVideo) { videoPlaybackPanel1.TargetSource = node as IVideo; newControl = videoPlaybackPanel1; } else if (node is MDL0MaterialRefNode) { newControl = texCoordControl1; } else if (node is MDL0ObjectNode) { newControl = mdL0ObjectControl1; } else if (node is MSBinNode) { msBinEditor1.CurrentNode = node as MSBinNode; newControl = msBinEditor1; } else if (node is CHR0EntryNode) { animEditControl.TargetSequence = node as CHR0EntryNode; newControl = animEditControl; } else if (node is SRT0TextureNode) { texAnimEditControl.TargetSequence = node as SRT0TextureNode; newControl = texAnimEditControl; } else if (node is SHP0VertexSetNode) { shpAnimEditControl.TargetSequence = node as SHP0VertexSetNode; newControl = shpAnimEditControl; } else if (node is RSARNode) { soundPackControl1.TargetNode = node as RSARNode; newControl = soundPackControl1; } else if (node is VIS0EntryNode) { visEditor.TargetNode = node as VIS0EntryNode; newControl = visEditor; } else if (node is SCN0CameraNode) { scN0CameraEditControl1.TargetSequence = node as SCN0CameraNode; newControl = scN0CameraEditControl1; } else if (node is SCN0LightNode) { scN0LightEditControl1.TargetSequence = node as SCN0LightNode; newControl = scN0LightEditControl1; disable2nd = true; } else if (node is SCN0FogNode) { scN0FogEditControl1.TargetSequence = node as SCN0FogNode; newControl = scN0FogEditControl1; disable2nd = true; } else if (node is IAudioSource) { audioPlaybackPanel1.TargetSource = node as IAudioSource; IAudioStream[] sources = audioPlaybackPanel1.TargetSource.CreateStreams(); if (sources != null && sources.Length > 0 && sources[0] != null) { newControl = audioPlaybackPanel1; } } else if (node is IImageSource) { previewPanel2.RenderingTarget = ((IImageSource)node); newControl = previewPanel2; } else if (node is IRenderedObject) { newControl = modelPanel1; } else if (node is STDTNode) { STDTNode stdt = (STDTNode)node; attributeGrid1.Clear(); attributeGrid1.AddRange(stdt.GetPossibleInterpretations()); attributeGrid1.TargetNode = stdt; newControl = attributeGrid1; } if (node is IColorSource && !disable2nd) { clrControl.ColorSource = node as IColorSource; if (((IColorSource)node).ColorCount(0) > 0) { if (newControl != null) { newControl2 = clrControl; } else { newControl = clrControl; } } } if ((editToolStripMenuItem.DropDown = w.ContextMenuStrip) != null) { editToolStripMenuItem.Enabled = true; } else { editToolStripMenuItem.Enabled = false; } } else { propertyGrid1.SelectedObject = null; try { editToolStripMenuItem.DropDown = null; } catch { } editToolStripMenuItem.Enabled = false; } if (_secondaryControl != newControl2) { if (_secondaryControl != null) { _secondaryControl.Dock = DockStyle.Fill; _secondaryControl.Visible = false; } _secondaryControl = newControl2; if (_secondaryControl != null) { _secondaryControl.Dock = DockStyle.Right; _secondaryControl.Visible = true; _secondaryControl.Width = 340; } } if (_currentControl != newControl) { if (_currentControl != null) { _currentControl.Visible = false; } _currentControl = newControl; if (_currentControl != null) { _currentControl.Visible = true; } } if (_currentControl != null) { if (_secondaryControl != null) { _currentControl.Width = splitContainer2.Panel2.Width - _secondaryControl.Width; } _currentControl.Dock = DockStyle.Fill; } //Model panel has to be loaded first to display model correctly if (_currentControl is ModelPanel) { if (node._children == null) { node.Populate(0); } if (node is IModel && ModelEditControl.Instances.Count == 0) { IModel m = node as IModel; m.ResetToBindState(); } IRenderedObject o = node as IRenderedObject; modelPanel1.AddTarget(o); modelPanel1.SetCamWithBox(o.GetBox()); } else if (_currentControl is MDL0ObjectControl) { mdL0ObjectControl1.SetTarget(node as MDL0ObjectNode); } else if (_currentControl is TexCoordControl) { texCoordControl1.TargetNode = ((MDL0MaterialRefNode)node); } }
internal void HandleModelShutdown(IModel model, ShutdownEventArgs reason) { // TODO }
/// <summary> /// Sets the Model to the given parameter /// </summary> /// <param name="m">a reference to the Model object that will /// be set to the Presenter's m member</param> public void SetModel(IModel m) { this.m = m; }
//internal constructor makes sure that objects are not created outside of the model/ assembly controlled area internal IfcSectionReinforcementProperties(IModel model, int label, bool activated) : base(model, label, activated) { _crossSectionReinforcementDefinitions = new ItemSet <IfcReinforcementBarProperties>(this, 0, 6); }
/// <summary> /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to /// the same compatibility standards as public APIs. It may be changed or removed without notice in /// any release. You should only use it directly in your code with extreme caution and knowing that /// doing so can result in application failures when updating to a new Entity Framework Core release. /// </summary> public RelationalModel(IModel model) { Model = model; }
public BrokerSender(IOptions <BrokerOptions> options) { _options = options.Value; _channel = BindChannel(); }
// private IView m_view; /// <summary> /// sets the model cobject /// </summary> /// <param name="model">our model object</param> public void SetModel(IModel model) { m_model = model; }
protected internal override (byte[], IBasicProperties) GetData(IModel channel, IBusSerializer serializer) { return(Data as byte[], _basicProperties); }
//internal constructor makes sure that objects are not created outside of the model/ assembly controlled area internal IfcCsgSolid(IModel model, int label, bool activated) : base(model, label, activated) { }
/// <summary> /// Construct an instance for writing. See <see cref="BasicMessageBuilder"/>. /// </summary> public MapMessageBuilder(IModel model) : base(model) { Body = new Dictionary <string, object>(); }
//internal constructor makes sure that objects are not created outside of the model/ assembly controlled area internal IfcProtectiveDeviceTrippingUnit(IModel model, int label, bool activated) : base(model, label, activated) { }
protected internal RabbitExchange(string exchangeName, string exchangeType, object arguments, IConnection connection, IModel channel) { ExchangeName = exchangeName; ExchangeType = exchangeType; _args = arguments == null ? new ReadOnlyDictionary <string, object>(new Dictionary <string, object>()) : new ReadOnlyDictionary <string, object>(arguments.Map()); _connection = connection; _channel = channel; }
protected override void ColumnDefinition( [CanBeNull] string schema, [NotNull] string table, [NotNull] string name, [NotNull] Type clrType, [CanBeNull] string type, [CanBeNull] bool?unicode, [CanBeNull] int?maxLength, bool rowVersion, bool nullable, [CanBeNull] object defaultValue, [CanBeNull] string defaultValueSql, [CanBeNull] string computedColumnSql, [NotNull] IAnnotatable annotatable, [CanBeNull] IModel model, [NotNull] MigrationCommandListBuilder builder) { Check.NotEmpty(name, nameof(name)); Check.NotNull(annotatable, nameof(annotatable)); Check.NotNull(clrType, nameof(clrType)); Check.NotNull(builder, nameof(builder)); var matchType = type; var matchLen = ""; var match = TypeRe.Match(type ?? "-"); if (match.Success) { matchType = match.Groups[1].Value.ToLower(); if (!string.IsNullOrWhiteSpace(match.Groups[2].Value)) { matchLen = match.Groups[2].Value; } } var autoIncrement = false; var valueGenerationStrategy = annotatable[FbAnnotationNames.ValueGenerationStrategy] as FirebirdValueGenerationStrategy?; if ((valueGenerationStrategy == FirebirdValueGenerationStrategy.IdentityColumn) && string.IsNullOrWhiteSpace(defaultValueSql) && defaultValue == null) { switch (matchType) { case "BIGINT": case "INTEGER": autoIncrement = true; break; case "TIMESTAMP": defaultValueSql = $"CURRENT_TIMESTAMP"; break; } } string onUpdateSql = null; if (valueGenerationStrategy == FirebirdValueGenerationStrategy.ComputedColumn) { switch (matchType) { case "TIMESTAMP": if (string.IsNullOrWhiteSpace(defaultValueSql) && defaultValue == null) { defaultValueSql = $"CURRENT_TIMESTAMP"; } onUpdateSql = $"CURRENT_TIMESTAMP"; break; } } builder .Append(Dependencies.SqlGenerationHelper.DelimitIdentifier(name)) .Append(" ") .Append(type ?? GetColumnType(schema, table, name, clrType, unicode, maxLength, rowVersion, model)); if (!nullable) { builder.Append((autoIncrement && _options.ConnectionSettings.ServerVersion.IdentityColumnsSupported ? " GENERATED BY DEFAULT AS IDENTITY": "") + " NOT NULL"); } if (!autoIncrement) { if (defaultValueSql != null) { builder .Append(" DEFAULT ") .Append(defaultValueSql); } else if (defaultValue != null) { var defaultValueLiteral = Dependencies.TypeMapper.GetMapping(clrType); builder .Append(" DEFAULT ") .Append(defaultValueLiteral.GenerateSqlLiteral(defaultValue)); } if (onUpdateSql != null) { builder .Append(" ON UPDATE ") .Append(onUpdateSql); } } }
public virtual void Generate(FbDropDatabaseOperation operation, IModel model, MigrationCommandListBuilder builder) { throw new NotSupportedException("Firebird doesn't support DropDatabase operation."); }
public ModelResource(string name, IModel model) { Name = name; Model = model; }
public static ScaffoldingModelAnnotations Scaffolding([NotNull] this IModel model) => new ScaffoldingModelAnnotations(Check.NotNull(model, nameof(model)));
protected override void Generate(EnsureSchemaOperation operation, IModel model, MigrationCommandListBuilder builder) { throw new NotSupportedException("Firebird doesn't support EnsureSchema operation."); }
protected override void Generate(RenameSequenceOperation operation, IModel model, MigrationCommandListBuilder builder) { throw new NotSupportedException("Firebird doesn't support sequence operation."); }
public RequiresBufferingExpressionVisitor(IModel model) { _model = model; }
//internal constructor makes sure that objects are not created outside of the model/ assembly controlled area internal IfcFuelProperties(IModel model, int label, bool activated) : base(model, label, activated) { }
public MasterClient() { Logger.Info("Server started"); ReadJsonData(); ConnectionFactory factory = new ConnectionFactory() { UserName = "******", Password = "******", HostName = "192.168.21.130" }; connection = factory.CreateConnection(); channel = connection.CreateModel(); channel.QueueDeclare(queue: "MasterClient", durable: false, exclusive: false, autoDelete: false, arguments: null); //channel.BasicQos(0, 1, false); var consumer = new EventingBasicConsumer(channel); channel.BasicConsume(queue: "MasterClient", autoAck: true, consumer: consumer); consumer.Received += (model, ea) => { //to do: new thread will be here? IBasicProperties props = ea.BasicProperties; if (!ClientsList.Exists((c) => c.QeueuName == props.ReplyTo)) { ClientsList.Add(new ClientPeer() { QeueuName = props.ReplyTo, LastUpTime = DateTime.UtcNow }); Logger.Info($"Was added a client: {props.ReplyTo}"); } Object obtained = ea.Body.Deserializer(); switch (obtained) { case PingPeer p: ClientPeer peer = ClientsList.FirstOrDefault((pr) => pr.QeueuName == props.ReplyTo); if (peer != null) { peer.LastUpTime = DateTime.UtcNow; } break; case RegistrationRequest r: RegisterUser(r, props.ReplyTo); break; case LoginRequest lr: Login(lr, props.ReplyTo); break; case LogoutRequest loutr: Logout(loutr.SessionId, props.ReplyTo); break; case LoginBySessionRequest lbsr: LoginBySession(lbsr.Session, props.ReplyTo); break; default: Logger.Error("Type is different!"); break; }//switch }; tokenSource = new CancellationTokenSource(); PingToAll(); }//ctor
//internal constructor makes sure that objects are not created outside of the model/ assembly controlled area internal IfcGeographicElement(IModel model, int label, bool activated) : base(model, label, activated) { }
//internal constructor makes sure that objects are not created outside of the model/ assembly controlled area internal IfcEquipmentElement(IModel model, int label, bool activated) : base(model, label, activated) { }
public Consumer(IRmqConnectionFactory connectionFactory, IUsernameProvider username) { _consumerChannel = connectionFactory.GetPublishChannel(); _username = username; }