Exemplo n.º 1
0
        private void Init()
        {
            CalcVersionString();
            _fileHelper.MoveDeployedRecources();
            _applicationSettings = _fileHelper.LoadAppSettings();
            if (_applicationSettings == null)
            {
                _applicationSettings = ApplicationSettings.CreateDefault();
            }

            _configurations = new ObservableCollection <ModelSettings>();
            IEnumerable <ModelSettings> loaded = _fileHelper.LoadAllSettings();

            foreach (var setting in loaded)
            {
                _configurations.Add(setting);
            }

            ModelSettings active = loaded.FirstOrDefault(x => x.FileName == _applicationSettings.ConfigurationFile);

            if (active != null)
            {
                ActiveConfigutaion = active;
            }
        }
        public void CanNotUseModelPermissions()
        {
            var permissionsMap = new Dictionary <Type, ModelSettings>();
            var permissions    = new ModelPermissionSettings()
            {
                RolesForCreate = "Admin",
                RolesForView   = "Admin",
                RolesForIndex  = "Admin",
                RolesForDelete = "Admin",
                RolesForManage = "Admin",
                RolesForImport = "Admin"
            };

            permissionsMap[typeof(Link)] = new ModelSettings()
            {
                Permissions = permissions
            };

            var securityHelper = new EntitySettingsHelper();

            securityHelper.Init(permissionsMap);

            Auth.Init(new AuthWin("Admin", new UserPrincipal(1, "kishore", "moderator", "custom", true)));

            // Check everything is false.
            Assert.IsFalse(securityHelper.HasAccessToCreate <Link>());
            Assert.IsFalse(securityHelper.HasAccessToDelete <Link>());
            Assert.IsFalse(securityHelper.HasAccessToImport <Link>());
            Assert.IsFalse(securityHelper.HasAccessToIndex <Link>());
            Assert.IsFalse(securityHelper.HasAccessToManage <Link>());
            Assert.IsFalse(securityHelper.HasAccessToView <Link>());
        }
Exemplo n.º 3
0
 /// <summary>
 /// Constructor: model location relative to .exe, mlcontext, model settings of input name and output name
 /// </summary>
 /// <param name="inputModelLocation"></param>
 /// <param name="inputMlContext"></param>
 /// <param name="inputModelSettings"></param>
 public OnnxRNNScorer(string inputModelLocation, MLContext inputMlContext, ModelSettings inputModelSettings)
 {
     modelLocation = inputModelLocation;
     mlContext     = inputMlContext;
     modelSettings = inputModelSettings;
     pipeline      = mlContext.Transforms.ApplyOnnxModel(modelFile: modelLocation, outputColumnNames: new[] { modelSettings.modelOutput }, inputColumnNames: new[] { modelSettings.modelInput });
 }
Exemplo n.º 4
0
        private void ButtonEdit_Click(object sender, RoutedEventArgs e)
        {
            if (Selected == null)
            {
                MessageBox.Show("Select configuration", "Not selected", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                return;
            }

            SettingsWindow window       = new SettingsWindow();
            var            selectedItem = Selected;
            ModelSettings  settingsCopy = Selected.MakeCopy();

            window.DataContext = selectedItem;
            window.Owner       = this;
            window.ShowDialog();
            if (window.DialogResult == true)
            {
                _fileHelper.SaveSetting(selectedItem);
            }
            else
            {
                bool isActiveConfig = MainViewModel.ActiveConfigutaion == selectedItem;
                int  currentIdx     = Items.IndexOf(selectedItem);
                Items[currentIdx] = settingsCopy;
                Selected          = settingsCopy;

                if (isActiveConfig)
                {
                    MainViewModel.ActiveConfigutaion = settingsCopy;
                }
            }
        }
Exemplo n.º 5
0
        internal Model(
            string teamspace,
            string modelId,
            string revisionId,
            ModelSettings settings,
            Dictionary <string, SuperMeshInfo> superMeshes,
            Vector3 offset,
            RepoWebClientInterface repoHttpClient)
        {
            this.teamspace      = teamspace;
            this.modelId        = modelId;
            this.revisionId     = revisionId;
            this.superMeshes    = superMeshes;
            this.offset         = offset;
            this.repoHttpClient = repoHttpClient;

            root = new GameObject(teamspace + "." + modelId);
            foreach (var smesh in superMeshes)
            {
                smesh.Value.gameObj.transform.parent = root.transform;
            }

            units          = settings.properties.unit;
            angleFromNorth = settings.angleFromNorth;


            if (hasSurveyPoints = (settings.surveyPoints != null && settings.surveyPoints.Length > 0))
            {
                surveyPoint = new Vector3(settings.surveyPoints[0].position[0], settings.surveyPoints[0].position[1], settings.surveyPoints[0].position[2]);
                latLong     = new Vector2(settings.surveyPoints[0].latLong[0], settings.surveyPoints[0].latLong[1]);
            }

            name = settings.name;
        }
Exemplo n.º 6
0
        public bool CheckModelSettings()
        {
            ModelSettings modelSettings = ReadModelSettings();
            ErrorResult   errorResult   = modelSettings.CehckSettings();

            if (errorResult.errorCode == ErrorCode.Success)
            {
                return(true);
            }
            lbMatlabPaths.SelectedIndex = lbScripts.SelectedIndex = -1;
            switch (errorResult.errorCode)
            {
            case ErrorCode.ModelSettingsMatlabExeError:
                tbMatlabExePath.Focus();
                tbMatlabExePath.SelectAll();
                break;

            case ErrorCode.ModelSettingsSimulinkModelError:
                tbSimulinkModelPath.Focus();
                tbSimulinkModelPath.SelectAll();
                break;

            case ErrorCode.ModelSettingsMatlabScriptError:
                lbScripts.SelectedItem = lbScripts.Items[errorResult.errorParemeter];
                break;

            case ErrorCode.ModelSettingsMatlabPathError:
                lbMatlabPaths.SelectedItem = lbMatlabPaths.Items[errorResult.errorParemeter];
                break;
            }
            MessageBox.Show("The highlighted directory/file does not exist!",
                            "Error Accessing File/Directory", MessageBoxButtons.OK);
            return(false);
        }
Exemplo n.º 7
0
        public RabbitMqModelCache(IConnectionCache connectionCache, ITaskSupervisor supervisor, ModelSettings modelSettings)
        {
            _connectionCache = connectionCache;
            _modelSettings   = modelSettings;

            _cacheTaskScope = supervisor.CreateScope($"{TypeMetadataCache<RabbitMqModelCache>.ShortName}", CloseScope);
        }
Exemplo n.º 8
0
        /// <summary>
        /// Add errors from entity to the model state.
        /// </summary>
        /// <param name="modelState"></param>
        /// <param name="entity"></param>
        public bool CanCreateModel(ModelSettings settings)
        {
            bool isAdmin = Auth.IsAdmin();

            if (isAdmin)
            {
                return(true);
            }

            // Not Admin and system model
            if (settings.IsSystemModel)
            {
                return(false);
            }

            var helper = _settingsFetcher();

            // only for role and not in role
            if (settings.Permissions.IsOnlyForRole && Auth.IsUserInRoles(settings.Permissions.RolesForModel))
            {
                return(true);
            }

            return(helper.IsAuthorizedFor(settings.Permissions.RolesForCreate));
        }
Exemplo n.º 9
0
 private void LoadModelSettings(ModelSettings modelSettings)
 {
     tbMatlabExePath.Text     = modelSettings.MatlabExePath;
     tbSimulinkModelPath.Text = modelSettings.SimulinkModelPath;
     for (int i = 0; i < modelSettings.MatlabScriptsPaths.Count; ++i)
     {
         lbScripts.Items.Add(modelSettings.MatlabScriptsPaths[i]);
     }
     if (modelSettings.MatlabScriptsPaths.Count > 0)
     {
         btnRemovePath.Enabled = true;
     }
     for (int i = 0; i < modelSettings.MatlabPaths.Count; ++i)
     {
         lbMatlabPaths.Items.Add(modelSettings.MatlabPaths[i]);
     }
     if (modelSettings.MatlabPaths.Count > 0)
     {
         btnRemovePath.Enabled = true;
     }
     if (modelSettings.MatlabScriptsPaths.Count > 0)
     {
         btnDelScript.Enabled = true;
     }
 }
Exemplo n.º 10
0
 private void CalcTotals(ObservableCollection <TaskGroup> groups, ModelSettings settings)
 {
     foreach (var group in groups)
     {
         group.CalculateTotals(settings);
     }
 }
Exemplo n.º 11
0
        private List <WorkLogDataRow> ReadFile(string fileName, ModelSettings settings)
        {
            if (!File.Exists(fileName))
            {
                return(null);
            }

            ExcelFile importFile = ExcelFile.Load(fileName);
            var       ws         = importFile.Worksheets[0];

            if (!string.IsNullOrEmpty(settings.ExcelTabName) && importFile.Worksheets.Contains(settings.ExcelTabName))
            {
                ws = importFile.Worksheets[settings.ExcelTabName];
            }


            List <WorkLogDataRow> rows = new List <WorkLogDataRow>();
            int rowIdx = 0;

            foreach (ExcelRow excelRow in ws.Rows)
            {
                if (rowIdx > 0)
                {
                    WorkLogDataRow row = ImportRow(excelRow, settings.SourceFileSettings);
                    if (row != null)
                    {
                        rows.Add(row);
                    }
                }
                rowIdx++;
            }
            return(rows);
        }
Exemplo n.º 12
0
        public RabbitMqModelCache(IConnectionCache connectionCache, ITaskSupervisor supervisor, ModelSettings modelSettings)
        {
            _connectionCache = connectionCache;
            _modelSettings = modelSettings;

            _cacheTaskScope = supervisor.CreateScope($"{TypeMetadataCache<RabbitMqModelCache>.ShortName}", CloseScope);
        }
Exemplo n.º 13
0
 public SeismicBuildingProperties(SeismicParameters seismicParameters, ModelSettings modelSettings, List <BuildingLevelLateral2> levels)
 {
     SeismicParameters = seismicParameters;
     BuildingWeight    = CalculateBuildingWeight(levels).ConvertTo(ForceUnit.Kip);
     T = ApproximatePeriod(modelSettings.BuildingHeight);
     k = CalculateKfactor();
 }
Exemplo n.º 14
0
        public void CalculateTotals(ModelSettings settings)
        {
            CalcItemsTotals();
            ResetTotals();
            _totalEstimationDevelopment = _tasks.Where(x => x.IsTaskRelatesToDevelopment).Sum(x => x.Estimation);

            _totalTimeBooked = _tasks.Sum(x => x.TimeSpentByDev);

            _totalDoneBookedDevelopment     = _tasks.Where(x => x.IsDone && x.IsTaskRelatesToDevelopment).Sum(x => x.TimeSpentByDev);
            _totalDoneEstimationDevelopment = _tasks.Where(x => x.IsDone && x.IsTaskRelatesToDevelopment).Sum(x => x.Estimation);

            _totalBookedMeetings    = _tasks.Where(x => x.IsTaskRelatesToMettings).Sum(x => x.TimeSpentByDev);
            _totalBookedDevelopment = _tasks.Where(x => x.IsTaskRelatesToDevelopment).Sum(x => x.TimeSpentByDev);

            if (!settings.SourceFileSettings.AssigneeField.AddAssignedToAnotherToDone)
            {
                double totalDoneButNotManagedByDeveloper           = _tasks.Where(x => !x.IsTaskAssigned && x.IsDone && x.IsTaskRelatesToDevelopment).Sum(x => x.TimeSpentByDev);
                double totalEstimationDoneButNotManagedByDeveloper = _tasks.Where(x => !x.IsTaskAssigned && x.IsDone && x.IsTaskRelatesToDevelopment).Sum(x => x.Estimation);
                _totalDoneBookedDevelopment     = _totalDoneBookedDevelopment - totalDoneButNotManagedByDeveloper;
                _totalDoneEstimationDevelopment = _totalDoneEstimationDevelopment -
                                                  totalEstimationDoneButNotManagedByDeveloper;
            }

            if (_totalBookedDevelopment > 0)
            {
                _rateDoneBookedToBookedDevelopment = _totalDoneBookedDevelopment / _totalBookedDevelopment;
            }
            else
            {
                if (_totalDoneBookedDevelopment > 0)
                {
                    _rateDoneBookedToBookedDevelopment = 1;
                }
                else
                {
                    _rateDoneBookedToBookedDevelopment = 0;
                }
            }

            if (_totalDoneEstimationDevelopment > 0)
            {
                _rateDoneEstimationToDevelopment = _totalDoneEstimationDevelopment / _totalBookedDevelopment;
            }
            else
            {
                if (_totalDoneEstimationDevelopment > 0)
                {
                    _rateDoneEstimationToDevelopment = 1;
                }
                else
                {
                    _rateDoneEstimationToDevelopment = 0;
                }
            }

            // calculates only done and development.
            _totalUnderEstimate = _tasks.Sum(x => x.UnderEstimate);
            RaisePropertyChanged(string.Empty);
        }
Exemplo n.º 15
0
 public void Setup(string inputModelLocation, MLContext inputMlContext, ImageNetSettings inputImageNetSettings, ModelSettings inputModelSettings, NormalizationSettings inputNormSettings)
 {
     modelLocation         = inputModelLocation;
     mlContext             = inputMlContext;
     modelSettings         = inputModelSettings;
     imageNetSettings      = inputImageNetSettings;
     normalizationSettings = inputNormSettings;
 }
Exemplo n.º 16
0
 public void modelSettingsToNative(ModelSettings modelSettings)
 {
     Model.DesignConcrete.SetCode(modelSettings.concreteCode);
     Model.DesignSteel.SetCode(modelSettings.steelCode);
     if (modelSettings.modelUnits != null)
     {
         UnitsToNative(modelSettings.modelUnits);
     }
 }
Exemplo n.º 17
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            if (!parentModelSettingsForm.CheckModelSettings())
            {
                return;
            }
            ModelSettings modelSettings = parentModelSettingsForm.ReadModelSettings();

            SettingFilesManager.SaveModelSettings(SettingFilesManager.SettingsFolderPath, modelSettings);
            Close();
        }
Exemplo n.º 18
0
        private void GetReflSettings(ref ModelSettings settings)
        {
            FileInfo info          = new FileInfo(origreflfilename);
            ReflData ReflArr       = ReflData.Instance;
            int      newdatapoints = ReflData.Instance.GetNumberDataPoints;

            settings.Directory = info.DirectoryName;
            settings.SetArrays(ReflArr.GetQData, ReflArr.GetReflData, ReflArr.GetRErrors, ReflArr.GetQErrors);

            FillSettingsStruct(ref settings);
        }
Exemplo n.º 19
0
        public RabbitMqBusBuilder(RabbitMqHost[] hosts, IConsumePipeFactory consumePipeFactory, ISendPipeFactory sendPipeFactory,
                                  IPublishPipeFactory publishPipeFactory, RabbitMqReceiveSettings busSettings, ModelSettings modelSettings)
            : base(consumePipeFactory, sendPipeFactory, publishPipeFactory, hosts)
        {
            _hosts         = hosts;
            _modelSettings = modelSettings;

            _autoDeleteCacheTimeout   = TimeSpan.FromMinutes(1);
            _sendEndpointCacheTimeout = TimeSpan.FromDays(1);

            _busEndpointConfigurator = new RabbitMqReceiveEndpointConfigurator(_hosts[0], busSettings, ConsumePipe);
        }
Exemplo n.º 20
0
        private void ComboSettings_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            // ugly workaround, combobox at first initialization set default first element.
            if (!this.IsLoaded)
            {
                return;
            }

            ModelSettings selected = ComboSettings.SelectedItem as ModelSettings;

            _mainViewModel.ActiveConfigutaion = selected;
        }
Exemplo n.º 21
0
        public RabbitMqBusBuilder(RabbitMqHost[] hosts, IConsumePipeFactory consumePipeFactory, ISendPipeFactory sendPipeFactory,
            IPublishPipeFactory publishPipeFactory, RabbitMqReceiveSettings busSettings, ModelSettings modelSettings)
            : base(consumePipeFactory, sendPipeFactory, publishPipeFactory, hosts)
        {
            _hosts = hosts;
            _modelSettings = modelSettings;

            _autoDeleteCacheTimeout = TimeSpan.FromMinutes(1);
            _sendEndpointCacheTimeout = TimeSpan.FromDays(1);

            _busEndpointConfigurator = new RabbitMqReceiveEndpointConfigurator(_hosts[0], busSettings, ConsumePipe);
        }
Exemplo n.º 22
0
 public TestWorkspace(String workspaceName, FunctionTypeEnum functionType)
 {
     this.workspaceName = workspaceName;
     this.functionType  = functionType;
     if (SettingFilesManager.modelSettingsExists(SettingFilesManager.SettingsFolderPath))
     {
         modelSettings = SettingFilesManager.LoadModelSettings(SettingFilesManager.SettingsFolderPath);
     }
     else
     {
         modelSettings = new ModelSettings();
     }
 }
 public RabbitMqConsumerPipeSpecification(IPipe <ReceiveContext> receivePipe, ReceiveSettings settings, IReceiveObserver receiveObserver,
                                          IReceiveEndpointObserver endpointObserver, IEnumerable <ExchangeBindingSettings> exchangeBindings, ITaskSupervisor supervisor,
                                          Mediator <ISetPrefetchCount> mediator)
 {
     _settings         = settings;
     _receiveObserver  = receiveObserver;
     _endpointObserver = endpointObserver;
     _supervisor       = supervisor;
     _exchangeBindings = exchangeBindings.ToArray();
     _receivePipe      = receivePipe;
     _mediator         = mediator;
     _modelSettings    = new RabbitMqModelSettings();
 }
 public RabbitMqConsumerPipeSpecification(IPipe <ReceiveContext> receivePipe, ReceiveSettings settings, IReceiveObserver receiveObserver,
                                          IReceiveEndpointObserver endpointObserver, IEnumerable <ExchangeBindingSettings> exchangeBindings, ITaskSupervisor supervisor,
                                          IManagementPipe managementPipe)
 {
     _settings         = settings;
     _receiveObserver  = receiveObserver;
     _endpointObserver = endpointObserver;
     _supervisor       = supervisor;
     _exchangeBindings = exchangeBindings.ToArray();
     _receivePipe      = receivePipe;
     _managementPipe   = managementPipe;
     _modelSettings    = new RabbitMqModelSettings();
 }
        /// <summary>
        /// Confirmational Dialog Result
        /// </summary>
        private void _Yes(object parameter)
        {
            ModelSettings.FolderPathOutput = _DefaultFolderPathOutput;
            ModelSettings.FolderPathInput  = _DefaultFolderPathInput;
            ModelSettings.NewNameFolder    = _DefaultNewNameFolder;
            ModelSettings.NewNameFile      = _DefaultNewNameFile;

            // write xml
            ModelSettings.WriteSettings();

            // dialog feedback
            this.DialogResult = DialogResult.OK;
            this.Close();
        }
Exemplo n.º 26
0
        /// <summary>
        /// Default constructor
        /// </summary>
        public Stochfit(string[] args)
        {
            InitializeComponent();

            //Set properties that persist
            Properties.Settings.Default.UseSLDSingleSession = UseSLDToolStripMenuItem.Checked = Properties.Settings.Default.UseSLD;
            forceRQ4GraphingToolStripMenuItem.Checked       = Properties.Settings.Default.ForceRQ4;
            SaveReminderCTB.Checked = Properties.Settings.Default.DisableSavePrompt;

            InfoStruct = new ModelSettings();
            //Object for thread synchronization
            lockobj = new Object();
            //Class instances that make controlling the graph easier
            reflgraphobject = new Graphing(string.Empty);
            rhographobject  = new Graphing(string.Empty);
            modelreflname   = "Model Independent Reflectivity";
            rhomodelname    = "rhomodel";

            FileNameTB.ReadOnly = true;
            //Set default values here for internationalization reasons
            Rholipid.Text    = (9.38).ToString();
            SubSLDTB.Text    = (9.38).ToString();
            SurfAbs.Text     = ((double)1.0e-14).ToString();
            SubAbs.Text      = ((double)2.0e-8).ToString();
            layerlength.Text = ((double)25.0).ToString();
            SupSLDTB.Text    = ((double)0).ToString();
            wavelength.Text  = (1.24).ToString();
            SupAbsTB.Text    = ((double)0).ToString();
            QErrTB.Text      = ((double)0).ToString();
            ParamTempTB.Text = (0.03).ToString();


            ImpNormCB_CheckedChanged(null, null);
            UseAbsCB_CheckedChanged(null, null);

            //Setup the graphs
            reflgraphobject.CreateGraph(ReflGraph, "Model Independent Reflectivity Fit", "Q", "Intensity", AxisType.Log);
            rhographobject.CreateGraph(RhoGraph, "Model Independent Electron Density Fit", "Z",
                                       "Normalized Electron Density", AxisType.Linear);


            if (args.Length > 0)
            {
                m_bloadfromcommandline = true;
                origreflfilename       = args[0];
                LoadDataFile(args[0]);
                IterationsTB.Text = args[1];
            }
        }
Exemplo n.º 27
0
        public ModelSettings modelSettingsToSpeckle()
        {
            var speckleModelSettings = new ModelSettings();

            speckleModelSettings.modelUnits = UnitsToSpeckle();
            string concreteCode = "";

            Model.DesignConcrete.GetCode(ref concreteCode);
            speckleModelSettings.concreteCode = concreteCode;
            string steelCode = "";

            Model.DesignSteel.GetCode(ref steelCode);
            speckleModelSettings.steelCode = steelCode;
            return(speckleModelSettings);
        }
Exemplo n.º 28
0
        public static MatlabCommand GetModelSettingsMatlabCommand(ModelSettings modelSettings)
        {
            CompositeMatlabCommand psc = new CompositeMatlabCommand();

            for (int i = 0; i < modelSettings.MatlabScriptsPaths.Count; ++i)
            {
                psc.AddCommand(new SingleMatlabCommand("run('" +
                                                       modelSettings.MatlabScriptsPaths[i] + "')"));
            }
            for (int i = 0; i < modelSettings.MatlabPaths.Count; ++i)
            {
                psc.AddCommand(new SingleMatlabCommand("addpath('" +
                                                       modelSettings.MatlabPaths[i] + "')"));
            }
            return(psc);
        }
Exemplo n.º 29
0
        public RabbitMqPublishEndpointProvider(IRabbitMqHost host, IMessageSerializer serializer, Uri sourceAddress, IPublishPipe publishPipe,
                                               ModelSettings modelSettings)
        {
            _host          = host;
            _serializer    = serializer;
            _sourceAddress = sourceAddress;
            _publishPipe   = publishPipe;
            _modelSettings = modelSettings;

            _publishObservable = new PublishObservable();

            var cacheId = NewId.NextGuid().ToString();

            _cache = new LazyMemoryCache <Type, ISendEndpoint>(cacheId, CreateSendEndpoint, GetEndpointCachePolicy, FormatAddressKey,
                                                               OnCachedEndpointRemoved);
        }
Exemplo n.º 30
0
        public ModelSettings ReadModelSettings()
        {
            ModelSettings modelSettings = new ModelSettings();

            modelSettings.MatlabExePath     = tbMatlabExePath.Text;
            modelSettings.SimulinkModelPath = tbSimulinkModelPath.Text;
            for (int i = 0; i < lbScripts.Items.Count; ++i)
            {
                modelSettings.MatlabScriptsPaths.Add(lbScripts.Items[i].ToString());
            }
            for (int i = 0; i < lbMatlabPaths.Items.Count; ++i)
            {
                modelSettings.MatlabPaths.Add(lbMatlabPaths.Items[i].ToString());
            }
            return(modelSettings);
        }
Exemplo n.º 31
0
        public ModelSettingsForm()
        {
            InitializeComponent();
            ModelSettings modelSettings;

            if (SettingFilesManager.modelSettingsExists(SettingFilesManager.SettingsFolderPath))
            {
                modelSettings = SettingFilesManager.LoadModelSettings(SettingFilesManager.SettingsFolderPath);
            }
            else
            {
                modelSettings = new ModelSettings();
            }
            parentModelSettingsForm = new ParentModelSettingsForm(
                modelSettings);
            this.Controls.Add(parentModelSettingsForm);
        }
Exemplo n.º 32
0
        private void ButtonNew_Click(object sender, RoutedEventArgs e)
        {
            ModelSettings model = new ModelSettings()
            {
                Name = "Data File Settings"
            };
            SettingsWindow window = new SettingsWindow();

            window.DataContext = model;
            window.Owner       = this;
            window.ShowDialog();
            if (window.DialogResult == true)
            {
                _fileHelper.SaveSetting(model);
                Items.Add(model);
            }
        }
Exemplo n.º 33
0
        RabbitMqModelContext(ConnectionContext connectionContext, IModel model, ModelSettings settings, ITaskParticipant participant)
            : base(new PayloadCacheScope(connectionContext))
        {
            _connectionContext = connectionContext;
            _model = model;
            _settings = settings;

            _participant = participant;

            _published = new ConcurrentDictionary<ulong, PendingPublish>();
            _taskScheduler = new LimitedConcurrencyLevelTaskScheduler(1);

            _model.ModelShutdown += OnModelShutdown;
            _model.BasicAcks += OnBasicAcks;
            _model.BasicNacks += OnBasicNacks;
            _model.BasicReturn += OnBasicReturn;

            if (settings.PublisherConfirmation)
            {
                _model.ConfirmSelect();
            }

            _participant.SetReady();
        }
Exemplo n.º 34
0
 public RabbitMqModelContext(ConnectionContext connectionContext, IModel model, ITaskScope taskScope, ModelSettings settings)
     : this(connectionContext, model, settings,
         taskScope.CreateParticipant($"{TypeMetadataCache<RabbitMqModelContext>.ShortName} - {connectionContext.HostSettings.ToDebugString()}"))
 {
 }
 public RabbitMqSendTransportProvider(IRabbitMqHost[] hosts, ModelSettings settings)
 {
     _hosts = hosts;
     _settings = settings;
 }