Esempio n. 1
0
 // Constructor, parameters are provided by service provider
 public ApiController(IIndexService indexService, INodesService nodesService, IGraphService graphService, ITpsService tpsService)
 {
     _indexService = indexService;
     _nodesService = nodesService;
     _graphService = graphService;
     _tpsService   = tpsService;
 }
Esempio n. 2
0
#pragma warning disable CS0618 // Type or member is obsolete

    // IDistributedLockManager is marked as obsolete, because it's not ready for "prime time"
    // however; it is used to managed singleton function execution within the functions fx !!!

    public GitHubAdapter(
        IAuthorizationSessionClient sessionClient,
        IAuthorizationTokenClient tokenClient,
        IDistributedLockManager distributedLockManager,
        ISecretsStoreProvider secretsStoreProvider,
        IHttpClientFactory httpClientFactory,
        IOrganizationRepository organizationRepository,
        IUserRepository userRepository,
        IDeploymentScopeRepository deploymentScopeRepository,
        IProjectRepository projectRepository,
        IComponentRepository componentRepository,
        IComponentTemplateRepository componentTemplateRepository,
        IAzureSessionService azureSessionService,
        IAzureResourceService azureResourceService,
        IGraphService graphService,
        IFunctionsHost functionsHost = null)
        : base(sessionClient, tokenClient, distributedLockManager, secretsStoreProvider, azureSessionService, graphService, organizationRepository, deploymentScopeRepository, projectRepository, userRepository)
    {
        this.httpClientFactory           = httpClientFactory ?? new DefaultHttpClientFactory();
        this.organizationRepository      = organizationRepository ?? throw new ArgumentNullException(nameof(organizationRepository));
        this.userRepository              = userRepository ?? throw new ArgumentNullException(nameof(userRepository));
        this.deploymentScopeRepository   = deploymentScopeRepository ?? throw new ArgumentNullException(nameof(deploymentScopeRepository));
        this.projectRepository           = projectRepository ?? throw new ArgumentNullException(nameof(projectRepository));
        this.componentRepository         = componentRepository ?? throw new ArgumentNullException(nameof(componentRepository));
        this.componentTemplateRepository = componentTemplateRepository ?? throw new ArgumentNullException(nameof(componentTemplateRepository));
        this.azureSessionService         = azureSessionService ?? throw new ArgumentNullException(nameof(azureSessionService));
        this.azureResourceService        = azureResourceService ?? throw new ArgumentNullException(nameof(azureResourceService));
        this.graphService  = graphService ?? throw new ArgumentNullException(nameof(graphService));
        this.functionsHost = functionsHost ?? FunctionsHost.Default;
    }
Esempio n. 3
0
        public NetworkGraphViewModel(IProjectService projectService, IImageExportService imageExportService, IGraphService graphService)
            : base("Network Graph")
        {
            _projectService     = projectService;
            _imageExportService = imageExportService;
            _graphService       = graphService;

            _projectService.ProjectOpened += _projectService_ProjectOpened;

            Messenger.Default.Register <ComparisonPerformedMessage>(this, msg => Graph = _graphService.GenerateNetworkGraph(_similarityMetric));
            Messenger.Default.Register <DomainModelChangedMessage>(this, msg =>
            {
                if (msg.AffectsComparison)
                {
                    Graph = null;
                }
            });
            Messenger.Default.Register <PerformingComparisonMessage>(this, msg => Graph = null);

            TaskAreas.Add(new TaskAreaCommandGroupViewModel("Similarity metric",
                                                            new TaskAreaCommandViewModel("Lexical", new RelayCommand(() => SimilarityMetric  = SimilarityMetric.Lexical)),
                                                            new TaskAreaCommandViewModel("Phonetic", new RelayCommand(() => SimilarityMetric = SimilarityMetric.Phonetic))));
            TaskAreas.Add(new TaskAreaItemsViewModel("Other tasks",
                                                     new TaskAreaCommandViewModel("Export this graph", new RelayCommand(Export))));
            _similarityScoreFilter = 0.7;
        }
Esempio n. 4
0
 public Worker(IGraphService graphService, IHueService hueService, ILogger <Worker> logger, IOptionsMonitor <ConfigWrapper> optionsAccessor, AppState appState)
 {
     Config      = optionsAccessor.CurrentValue;
     _hueService = hueService;
     _logger     = logger;
     _appState   = appState;
 }
Esempio n. 5
0
 public App(IOptionsMonitor <ConfigWrapper> optionsAccessor, IGraphService graphService, IHueService hueService)
 {
     _options            = optionsAccessor.CurrentValue;
     _graphservice       = graphService;
     _hueService         = hueService;
     _graphServiceClient = _graphservice.GetAuthenticatedGraphClient(typeof(DeviceCodeFlowAuthorizationProvider));
 }
        public MainWindow(IGraphService graphService, IHueService hueService, LIFXService lifxService, IYeelightService yeelightService, ICustomApiService customApiService, IOptionsMonitor <ConfigWrapper> optionsAccessor, LIFXOAuthHelper lifxOAuthHelper)
        {
            InitializeComponent();

            System.Windows.Application.Current.SessionEnding += new SessionEndingCancelEventHandler(Current_SessionEnding);

            LoadAboutMe();

            _graphservice     = graphService;
            _yeelightService  = yeelightService;
            _lifxService      = lifxService;
            _hueService       = hueService;
            _customApiService = customApiService;
            _options          = optionsAccessor.CurrentValue;
            _lIFXOAuthHelper  = lifxOAuthHelper;
            LoadSettings().ContinueWith(
                t =>
            {
                if (t.IsFaulted)
                {
                }

                this.Dispatcher.Invoke(() =>
                {
                    LoadApp();

                    var tbContext = notificationIcon.DataContext;
                    DataContext   = Config;
                    notificationIcon.DataContext = tbContext;
                });
            });
        }
Esempio n. 7
0
        public MainWindow(IGraphService graphService, IHueService hueService, LIFXService lifxService, IOptionsMonitor <ConfigWrapper> optionsAccessor, LIFXOAuthHelper lifxOAuthHelper)
        {
            InitializeComponent();

            LoadAboutMe();

            _graphservice = graphService;

            _lifxService     = lifxService;
            _hueService      = hueService;
            _options         = optionsAccessor.CurrentValue;
            _lIFXOAuthHelper = lifxOAuthHelper;
            LoadSettings().ContinueWith(
                t =>
            {
                if (t.IsFaulted)
                {
                }

                this.Dispatcher.Invoke(() =>
                {
                    LoadApp();

                    var tbContext = notificationIcon.DataContext;
                    DataContext   = Config;
                    notificationIcon.DataContext = tbContext;
                });
            });
        }
        //
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        internal virtual IGraphService CreateIGraphService()
        {
            // TODO: Instantiate an appropriate concrete class.
            IGraphService target = null;

            return(target);
        }
 public IncomeGraphViewModel(IGraphService graphService,
     ITransactionService transactionService)
 {
     _GraphService = graphService;
     _TransactionService = transactionService;
     Initialize();
 }
Esempio n. 10
0
        public void Init()
        {
            _fakeDb = new FakeDb <Graph>();
            var myDbContextMock = new Mock <MyDbContext>();

            _graphService = new GraphService();
        }
Esempio n. 11
0
        public MainWindow(IGraphService graphService, IHueService hueService, IOptionsMonitor <ConfigWrapper> optionsAccessor)
        {
            _options = optionsAccessor.CurrentValue;


            InitializeComponent();

            if (string.IsNullOrEmpty(_options.ApplicationId) || string.IsNullOrEmpty(_options.TenantId) || string.IsNullOrEmpty(_options.RedirectUri))
            {
                configErrorPanel.Visibility = Visibility.Visible;
                dataPanel.Visibility        = Visibility.Hidden;
                signInPanel.Visibility      = Visibility.Hidden;
            }
            else
            {
                _graphservice       = graphService;
                _graphServiceClient = _graphservice.GetAuthenticatedGraphClient(typeof(WPFAuthorizationProvider));
            }

            if (_options.IconType == "Transparent")
            {
                Transparent.IsChecked = true;
            }
            else
            {
                White.IsChecked = true;
            }


            _hueService = hueService;

            notificationIcon.ToolTipText = PresenceConstants.Inactive;
            notificationIcon.IconSource  = new BitmapImage(new Uri(IconConstants.GetIcon(String.Empty, IconConstants.Inactive)));
        }
 protected ViewModel()
 {
     _navigationService     = (Application.Current as App).NavigationService;
     _eventAggregator       = (Application.Current as App).EventAggregator;
     _officeService         = (Application.Current as App).OfficeService;
     _authenticationService = (Application.Current as App).AuthenticationService;
 }
Esempio n. 13
0
        public HierarchicalGraphViewModel(IProjectService projectService, IImageExportService exportService, IGraphService graphService)
            : base("Hierarchical Graph")
        {
            _projectService = projectService;
            _exportService  = exportService;
            _graphService   = graphService;

            _projectService.ProjectOpened += _projectService_ProjectOpened;

            Messenger.Default.Register <ComparisonPerformedMessage>(this, msg => Graph = _graphService.GenerateHierarchicalGraph(_graphType, _clusteringMethod, _similarityMetric));
            Messenger.Default.Register <DomainModelChangedMessage>(this, msg =>
            {
                if (msg.AffectsComparison)
                {
                    Graph = null;
                }
            });
            Messenger.Default.Register <PerformingComparisonMessage>(this, msg => Graph = null);

            TaskAreas.Add(new TaskAreaCommandGroupViewModel("Graph type",
                                                            new TaskAreaCommandViewModel("Dendrogram", new RelayCommand(() => GraphType = HierarchicalGraphType.Dendrogram)),
                                                            new TaskAreaCommandViewModel("Tree", new RelayCommand(() => GraphType       = HierarchicalGraphType.Tree))));
            TaskAreas.Add(new TaskAreaCommandGroupViewModel("Clustering method",
                                                            new TaskAreaCommandViewModel("UPGMA", new RelayCommand(() => ClusteringMethod            = ClusteringMethod.Upgma)),
                                                            new TaskAreaCommandViewModel("Neighbor-joining", new RelayCommand(() => ClusteringMethod = ClusteringMethod.NeighborJoining))));
            TaskAreas.Add(new TaskAreaCommandGroupViewModel("Similarity metric",
                                                            new TaskAreaCommandViewModel("Lexical", new RelayCommand(() => SimilarityMetric  = SimilarityMetric.Lexical)),
                                                            new TaskAreaCommandViewModel("Phonetic", new RelayCommand(() => SimilarityMetric = SimilarityMetric.Phonetic))));
            TaskAreas.Add(new TaskAreaItemsViewModel("Other tasks",
                                                     new TaskAreaCommandViewModel("Export this graph", new RelayCommand(Export))));
            _graphType = HierarchicalGraphType.Dendrogram;
        }
        public MailViewModel(INavigationService navigationService, IGraphService graphWebService) : base(navigationService, graphWebService)
        {
            this.Title            = "Bandeja de entrada";
            this.selectedListMail = null;

            Analytics.TrackEvent("Acceso a la bandeja de entrada");
        }
        public async Task <ActionResult> Subscribe(AlertFilterViewModel actViewAlertFilter)
        {
            try
            {
                var startDateTime = DateTime.Now;
                var token         = string.Empty;

                if (Request.Headers.ContainsKey("Authorization"))
                {
                    token = Request.Headers["Authorization"].ToString()?.Split(" ")?[1];
                }

                _graphService = _graphServiceProvider.GetService(token);

                if (actViewAlertFilter != null && actViewAlertFilter.Filters.GetFilterValue("alert:category").Equals("Any") &&
                    actViewAlertFilter.Filters.GetFilterValue("vendor:provider").Equals("Any") &&
                    actViewAlertFilter.Filters.GetFilterValue("alert:severity").Equals("Any"))
                {
                    return(BadRequest("Please select at least one property/criterion for subscribing to alert notifications"));
                }
                else
                {
                    var filter = new AlertFilterModel(actViewAlertFilter);
                    var createSubscriptionResult = await _graphService.SubscribeAsync(filter);

                    var subscription = createSubscriptionResult.Item1;
                    Debug.WriteLine($"SubscriptionController Subscribe execution time: {DateTime.Now - startDateTime}");
                    return(Ok(subscription));
                }
            }
            catch (Exception exception)
            {
                return(BadRequest(exception.Message));
            }
        }
Esempio n. 16
0
 public DetailsViewModel(IGraphService graphService, IConfigService configService,
                         IDialogService dialogService)
 {
     _graphService  = graphService;
     _configService = configService;
     _dialogService = dialogService;
 }
Esempio n. 17
0
        public HierarchicalGraphViewModel(IProjectService projectService, IImageExportService exportService, IGraphService graphService)
            : base("Hierarchical Graph")
        {
            _projectService = projectService;
            _exportService = exportService;
            _graphService = graphService;

            _projectService.ProjectOpened += _projectService_ProjectOpened;

            Messenger.Default.Register<ComparisonPerformedMessage>(this, msg =>
            {
                if (_projectService.AreAllVarietiesCompared)
                    Graph = _graphService.GenerateHierarchicalGraph(_graphType, _clusteringMethod, _similarityMetric);
            });
            Messenger.Default.Register<DomainModelChangedMessage>(this, msg =>
            {
                if (msg.AffectsComparison)
                    Graph = null;
            });
            Messenger.Default.Register<PerformingComparisonMessage>(this, msg => Graph = null);

            TaskAreas.Add(new TaskAreaCommandGroupViewModel("Graph type",
                new TaskAreaCommandViewModel("Dendrogram", new RelayCommand(() => GraphType = HierarchicalGraphType.Dendrogram)),
                new TaskAreaCommandViewModel("Tree", new RelayCommand(() => GraphType = HierarchicalGraphType.Tree))));
            TaskAreas.Add(new TaskAreaCommandGroupViewModel("Clustering method",
                new TaskAreaCommandViewModel("UPGMA", new RelayCommand(() => ClusteringMethod = ClusteringMethod.Upgma)),
                new TaskAreaCommandViewModel("Neighbor-joining", new RelayCommand(() => ClusteringMethod = ClusteringMethod.NeighborJoining))));
            TaskAreas.Add(new TaskAreaCommandGroupViewModel("Similarity metric",
                new TaskAreaCommandViewModel("Lexical", new RelayCommand(() => SimilarityMetric = SimilarityMetric.Lexical)),
                new TaskAreaCommandViewModel("Phonetic", new RelayCommand(() => SimilarityMetric = SimilarityMetric.Phonetic))));
            TaskAreas.Add(new TaskAreaItemsViewModel("Other tasks",
                new TaskAreaCommandViewModel("Export graph", new RelayCommand(Export, CanExport))));
            _graphType = HierarchicalGraphType.Dendrogram;
        }
Esempio n. 18
0
        public NetworkGraphViewModel(IProjectService projectService, IImageExportService imageExportService, IGraphService graphService)
            : base("Network Graph")
        {
            _projectService = projectService;
            _imageExportService = imageExportService;
            _graphService = graphService;

            _projectService.ProjectOpened += _projectService_ProjectOpened;

            Messenger.Default.Register<ComparisonPerformedMessage>(this, msg =>
            {
                if (_projectService.AreAllVarietiesCompared)
                    Graph = _graphService.GenerateNetworkGraph(_similarityMetric);
            });
            Messenger.Default.Register<DomainModelChangedMessage>(this, msg =>
            {
                if (msg.AffectsComparison)
                    Graph = null;
            });
            Messenger.Default.Register<PerformingComparisonMessage>(this, msg => Graph = null);

            TaskAreas.Add(new TaskAreaCommandGroupViewModel("Similarity metric",
                new TaskAreaCommandViewModel("Lexical", new RelayCommand(() => SimilarityMetric = SimilarityMetric.Lexical)),
                new TaskAreaCommandViewModel("Phonetic", new RelayCommand(() => SimilarityMetric = SimilarityMetric.Phonetic))));
            TaskAreas.Add(new TaskAreaItemsViewModel("Other tasks",
                new TaskAreaCommandViewModel("Export graph", new RelayCommand(Export, CanExport))));
            _similarityScoreFilter = 0.7;
        }
Esempio n. 19
0
        public async Task <ActionResult> GetSecureScores(string queryParameter)
        {
            var startDateTime = DateTime.Now;

            try
            {
                var token = string.Empty;

                if (Request.Headers.ContainsKey("Authorization"))
                {
                    token = Request.Headers["Authorization"].ToString()?.Split(" ")?[1];
                }

                _graphService = _graphServiceProvider.GetService(token);

                var securityScores = await _graphService.GetSecureScoresAsync(queryParameter);

                Debug.WriteLine($"Secure Score Controller GetSecureScores execution time: {DateTime.Now - startDateTime}");
                return(Ok(securityScores));
            }
            catch (Exception exception)
            {
                return(BadRequest(exception.Message));
            }
        }
Esempio n. 20
0
        public async Task <ActionResult> Statistics(int count = 1000)
        {
            try
            {
                var start = DateTime.Now;
                var token = string.Empty;
                if (Request.Headers.ContainsKey("Authorization"))
                {
                    token = Request.Headers["Authorization"].ToString()?.Split(" ")?[1];
                }

                _graphService = _graphServiceProvider.GetService(token);

                var statistic = await _graphService.GetStatisticAsync(count);

                var alertStatisticResponse = statistic.ToAlertStatisticResponse();

                Debug.WriteLine($"Executing time AlertController Statistics: {DateTime.Now - start}");
                return(Ok(alertStatisticResponse));
            }
            catch (Exception exception)
            {
                return(BadRequest(exception.Message));
            }
        }
Esempio n. 21
0
        public PinViewModel(IMessageBus messageBus, IGraphService graphService)
        {
            MessageBus   = messageBus;
            GraphService = graphService;

            H.Initialize(this);
        }
Esempio n. 22
0
        public override void OnActionExecuting(ActionExecutingContext context)
        {
            graphService = context.HttpContext.RequestServices.GetService(typeof(IGraphService)) as IGraphService;

            SetupGroups(context);

            string currentUserName = string.Empty;
            IEnumerable <GroupInfo> allGroupsCurrentUserBelongsTo = null;

            currentUserName = context.HttpContext.User.FindFirst(ClaimTypes.Name).Value;

            allGroupsCurrentUserBelongsTo = graphService.GetAllGroupsOfUser(currentUserName).Result;
            bool isAuthorized = AuthorizeIfUserIsMemberOfAllowedGroups(allGroupsCurrentUserBelongsTo.Select(x => x.Id));

            if (!isAuthorized)
            {
                isAuthorized = AuthorizeIfUserIsOwnerOfAllowedGroups(currentUserName);
            }

            if (!isAuthorized)
            {
                var result = new ObjectResult(new ApiUnauthorizedResponse())
                {
                    StatusCode = (int)HttpStatusCode.Unauthorized
                };

                context.Result = result;
            }

            base.OnActionExecuting(context);
        }
Esempio n. 23
0
 public UserService(IHttpContextAccessor httpContextAccessor, IGraphService graphService, IMemoryCache cache, IUserRepository userRepository)
 {
     this.httpContextAccessor = httpContextAccessor ?? throw new ArgumentNullException(nameof(httpContextAccessor));
     this.graphService        = graphService ?? throw new ArgumentNullException(nameof(graphService));
     this.cache          = cache ?? throw new ArgumentNullException(nameof(cache));
     this.userRepository = userRepository ?? throw new ArgumentNullException(nameof(userRepository));
 }
Esempio n. 24
0
 public ComponentTaskExpander(IProjectRepository projectRepository, IAzureResourceService azureResourceService, IGraphService graphService, ICommandAuditReader commandAuditReader, IMemoryCache cache, TelemetryClient telemetryClient) : base(true, telemetryClient)
 {
     this.projectRepository    = projectRepository ?? throw new ArgumentNullException(nameof(projectRepository));
     this.azureResourceService = azureResourceService ?? throw new ArgumentNullException(nameof(azureResourceService));
     this.graphService         = graphService ?? throw new ArgumentNullException(nameof(graphService));
     this.commandAuditReader   = commandAuditReader ?? throw new ArgumentNullException(nameof(commandAuditReader));
     this.cache = cache ?? throw new ArgumentNullException(nameof(cache));
 }
        public NodesViewModel(INodeService nodeService, IGraphService graphService, IAttribuetDescriptionService attribuetDescriptionService)
        {
            _nodeService  = nodeService;
            _graphService = graphService;
            _attribuetDescriptionService = attribuetDescriptionService;

            SaveCommand = new BaseCommand(SaveExecute, o => SelectedNodeModel != null);
        }
Esempio n. 26
0
        public void InvokeClose()
        {
            SelectedGraphModel = null;
            SideBar            = null;

            _graphService.Dispose();
            _graphService = null;
        }
Esempio n. 27
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UserController"/> class.
 /// </summary>
 /// <param name="graphService">Graph Service</param>
 /// <param name="logger">Logger</param>
 /// <param name="config">General Config</param>
 public UserController(
     IGraphService graphService,
     ILogger <UserController> logger,
     IOptions <GeneralConfig> config)
     : base(logger, config)
 {
     this.graphService = graphService;
 }
        public ConnectionsViewModel(IConnectionService connectionService, INodeService nodeService, IGraphService graphService, IConnectionTypeService connectionTypeService)
        {
            _connectionTypeService = connectionTypeService;
            _connectionService     = connectionService;
            _nodeService           = nodeService;
            _graphService          = graphService;

            SaveCommand = new BaseCommand(SaveExecute, o => SelectedConnection != null);
        }
        public AuditController(IGraphService graphService)
        {
            if (graphService == null)
            {
                throw new ArgumentNullException(nameof(graphService));
            }

            _graphService = graphService;
        }
Esempio n. 30
0
 public LogicAgent(IAttribuetDescriptionService attribuetDescriptionService, IConnectionService connectionService,
                   IConnectionTypeService connectionTypeService, IGraphService graphService, INodeService nodeService)
 {
     _attribuetDescriptionService = attribuetDescriptionService;
     _connectionService           = connectionService;
     _connectionTypeService       = connectionTypeService;
     _graphService = graphService;
     _nodeService  = nodeService;
 }
Esempio n. 31
0
 public GraphController()
 {
     _centroRepository      = new CentroRepository();
     _centroService         = new CentroService(_centroRepository);
     _graphService          = new GraphService();
     _usuarioRepository     = new UsuarioRepository();
     _usuarioService        = new UsuarioService(_usuarioRepository);
     _candidaturaRepository = new CandidaturaRepository();
 }
Esempio n. 32
0
        /// <summary>
        ///   Starts the actual service
        /// </summary>
        /// <param name="fallen8"> Fallen-8. </param>
        private void StartService(Fallen8 fallen8)
        {
            _uri = new Uri("http://" + _address + ":" + _port + "/" + _uriPattern);

            if (!_uri.IsWellFormedOriginalString())
            {
                throw new Exception("The URI Pattern is not well formed!");
            }

            Service = new GraphService(fallen8);

            _host = new ServiceHost(Service, _uri)
            {
                CloseTimeout = new TimeSpan(0, 0, 0, 0, 50)
            };

            _restServiceAddress = "REST";

            try
            {
                var binding = new WebHttpBinding
                {
                    MaxBufferSize          = 268435456,
                    MaxReceivedMessageSize = 268435456,
                    SendTimeout            = new TimeSpan(1, 0, 0),
                    ReceiveTimeout         = new TimeSpan(1, 0, 0)
                };

                var readerQuotas = new XmlDictionaryReaderQuotas
                {
                    MaxDepth = 2147483647,
                    MaxStringContentLength = 2147483647,
                    MaxBytesPerRead        = 2147483647,
                    MaxNameTableCharCount  = 2147483647,
                    MaxArrayLength         = 2147483647
                };

                binding.ReaderQuotas = readerQuotas;

                var se       = _host.AddServiceEndpoint(typeof(IGraphService), binding, _restServiceAddress);
                var webBehav = new WebHttpBehavior
                {
                    HelpEnabled = true
                };
                se.Behaviors.Add(webBehav);

                ((ServiceBehaviorAttribute)_host.Description.Behaviors[typeof(ServiceBehaviorAttribute)]).
                InstanceContextMode = InstanceContextMode.Single;
            }
            catch (Exception)
            {
                _host.Abort();
                throw;
            }
        }
Esempio n. 33
0
        public void Setup()
        {
            _mockHttp = new MockHttpMessageHandler();
            var client         = _mockHttp.ToHttpClient();
            var stockMarketAPI = new StockMarketAPI(client);

            MockData();
            var stockMarketData = new StockMarketData(stockMarketAPI);

            _graphService = new GraphService(stockMarketData);
        }
        public GlobalCorrespondencesViewModel(IProjectService projectService, IBusyService busyService, IDialogService dialogService, IImageExportService imageExportService, IGraphService graphService,
			WordPairsViewModel.Factory wordPairsFactory, WordPairViewModel.Factory wordPairFactory)
            : base("Global Correspondences")
        {
            _projectService = projectService;
            _busyService = busyService;
            _dialogService = dialogService;
            _imageExportService = imageExportService;
            _graphService = graphService;
            _wordPairFactory = wordPairFactory;

            _selectedVarieties = new HashSet<Variety>();

            _projectService.ProjectOpened += _projectService_ProjectOpened;

            Messenger.Default.Register<ComparisonPerformedMessage>(this, msg => GenerateGraph());
            Messenger.Default.Register<DomainModelChangedMessage>(this, msg =>
            {
                if (msg.AffectsComparison)
                    ClearGraph();
            });
            Messenger.Default.Register<PerformingComparisonMessage>(this, msg => ClearGraph());

            _findCommand = new RelayCommand(Find);

            TaskAreas.Add(new TaskAreaCommandGroupViewModel("Syllable position",
                new TaskAreaCommandViewModel("Onset", new RelayCommand(() => SyllablePosition = SyllablePosition.Onset)),
                new TaskAreaCommandViewModel("Nucleus", new RelayCommand(() => SyllablePosition = SyllablePosition.Nucleus)),
                new TaskAreaCommandViewModel("Coda", new RelayCommand(() => SyllablePosition = SyllablePosition.Coda))));
            _correspondenceFilter = new TaskAreaIntegerViewModel("Frequency threshold");
            _correspondenceFilter.PropertyChanging += _correspondenceFilter_PropertyChanging;
            _correspondenceFilter.PropertyChanged += _correspondenceFilter_PropertyChanged;
            TaskAreas.Add(_correspondenceFilter);
            TaskAreas.Add(new TaskAreaItemsViewModel("Common tasks",
                new TaskAreaCommandViewModel("Find words", _findCommand),
                new TaskAreaItemsViewModel("Sort word pairs by", new TaskAreaCommandGroupViewModel(
                    new TaskAreaCommandViewModel("Gloss", new RelayCommand(() => _observedWordPairs.UpdateSort("Meaning.Gloss", ListSortDirection.Ascending))),
                    new TaskAreaCommandViewModel("Similarity", new RelayCommand(() => _observedWordPairs.UpdateSort("PhoneticSimilarityScore", ListSortDirection.Descending))))),
                new TaskAreaCommandViewModel("Select varieties", new RelayCommand(SelectVarieties))
                ));
            TaskAreas.Add(new TaskAreaItemsViewModel("Other tasks",
                new TaskAreaCommandViewModel("Export chart", new RelayCommand(ExportChart, CanExportChart))));
            _observedWordPairs = wordPairsFactory();
            _observedWordPairs.IncludeVarietyNamesInSelectedText = true;
            _observedWordPairs.UpdateSort("Meaning.Gloss", ListSortDirection.Ascending);
        }
Esempio n. 35
0
        /// <summary>
        ///   Starts the actual service
        /// </summary>
        /// <param name="fallen8"> Fallen-8. </param>
        private void StartService(Fallen8 fallen8)
        {
            #region configuration
            var configs = new Dictionary<String, String>();
            foreach (String key in ConfigurationManager.AppSettings)
            {
                var value = ConfigurationManager.AppSettings[key];

                configs.Add(key, value);
            }

            String graphIpAddress;
            configs.TryGetValue("GraphIPAddress", out graphIpAddress);

            UInt16 graphPort = 2323;
            String graphPortString;
            if (configs.TryGetValue("GraphPort", out graphPortString))
            {
                graphPort = Convert.ToUInt16(graphPortString);
            }

            String graphUriPattern;
            configs.TryGetValue("GraphUriPattern", out graphUriPattern);

            String restServiceAddress;
            configs.TryGetValue("RESTServicePattern", out restServiceAddress);

            #endregion

            var address = String.IsNullOrWhiteSpace(graphIpAddress) ? IPAddress.Any.ToString() : graphIpAddress;
            var port = graphPort;
            var uriPattern = String.IsNullOrWhiteSpace(graphUriPattern) ? "Graph" : graphUriPattern;

            _uri = new Uri("http://" + address + ":" + port + "/" + uriPattern);

            if (!_uri.IsWellFormedOriginalString())
                throw new Exception("The URI Pattern is not well formed!");

            Service = new GraphService(fallen8);

            _host = new ServiceHost(Service, _uri)
                        {
                            CloseTimeout = new TimeSpan(0, 0, 0, 0, 50)
                        };

            _restServiceAddress = String.IsNullOrWhiteSpace(restServiceAddress) ? "REST" : restServiceAddress;

            try
            {
                var binding = new WebHttpBinding
                                  {
                                      MaxBufferSize = 268435456,
                                      MaxReceivedMessageSize = 268435456,
                                      SendTimeout = new TimeSpan(1, 0, 0),
                                      ReceiveTimeout = new TimeSpan(1, 0, 0)
                                  };

                var readerQuotas = new XmlDictionaryReaderQuotas
                                       {
                                           MaxDepth = 2147483647,
                                           MaxStringContentLength = 2147483647,
                                           MaxBytesPerRead = 2147483647,
                                           MaxNameTableCharCount = 2147483647,
                                           MaxArrayLength = 2147483647
                                       };

                binding.ReaderQuotas = readerQuotas;

                var se = _host.AddServiceEndpoint(typeof (IGraphService), binding, _restServiceAddress);
                var webBehav = new WebHttpBehavior
                                   {
                                       HelpEnabled = true
                                   };
                se.Behaviors.Add(webBehav);

                ((ServiceBehaviorAttribute) _host.Description.Behaviors[typeof (ServiceBehaviorAttribute)]).
                    InstanceContextMode = InstanceContextMode.Single;
            }
            catch (Exception)
            {
                _host.Abort();
                throw;
            }
        }
Esempio n. 36
0
 public CustomerController(IResellerService ResellerService, IGraphService GraphService, ICRESTService CrestService)
 {
     this.resellerService = ResellerService;
     this.graphService = GraphService;
     this.crestService = CrestService;
 }
 public SubscriptionController(IResellerService ResellerService, IGraphService GraphService, ICRESTService CrestService)
 {
     this.resellerService = ResellerService;
     this.graphService = GraphService;
     this.crestService = CrestService;
 }
Esempio n. 38
0
        /// <summary>
        ///   Starts the actual service
        /// </summary>
        /// <param name="fallen8"> Fallen-8. </param>
        private void StartService(Fallen8 fallen8)
        {
            _uri = new Uri("http://" + _address + ":" + _port + "/" + _uriPattern);

            if (!_uri.IsWellFormedOriginalString())
                throw new Exception("The URI Pattern is not well formed!");

            Service = new GraphService(fallen8);

            _host = new ServiceHost(Service, _uri)
                        {
                            CloseTimeout = new TimeSpan(0, 0, 0, 0, 50)
                        };

            _restServiceAddress = "REST";

            try
            {
                var binding = new WebHttpBinding
                                  {
                                      MaxBufferSize = 268435456,
                                      MaxReceivedMessageSize = 268435456,
                                      SendTimeout = new TimeSpan(1, 0, 0),
                                      ReceiveTimeout = new TimeSpan(1, 0, 0)
                                  };

                var readerQuotas = new XmlDictionaryReaderQuotas
                                       {
                                           MaxDepth = 2147483647,
                                           MaxStringContentLength = 2147483647,
                                           MaxBytesPerRead = 2147483647,
                                           MaxNameTableCharCount = 2147483647,
                                           MaxArrayLength = 2147483647
                                       };

                binding.ReaderQuotas = readerQuotas;

                var se = _host.AddServiceEndpoint(typeof (IGraphService), binding, _restServiceAddress);
                var webBehav = new WebHttpBehavior
                                   {
                                       HelpEnabled = true
                                   };
                se.Behaviors.Add(webBehav);

                ((ServiceBehaviorAttribute) _host.Description.Behaviors[typeof (ServiceBehaviorAttribute)]).
                    InstanceContextMode = InstanceContextMode.Single;
            }
            catch (Exception)
            {
                _host.Abort();
                throw;
            }
        }