예제 #1
0
파일: Startup.cs 프로젝트: ngs-doo/revenj
 public static IServiceProvider Start(IDictionary<string, string> settings)
 {
     var configuration = new Configuration(new Dictionary<string, string>(settings));
     var locator = new DictionaryServiceLocator();
     var protobuf = new ProtobufSerialization();
     var restHttp = new HttpClient(locator, protobuf, configuration);
     var app = new ApplicationProxy(restHttp);
     var domain = new DomainProxy(restHttp, app);
     var report = new ReportingProxy(restHttp, app);
     locator.Register(typeof(Configuration), configuration);
     locator.Register(typeof(ProtobufSerialization), protobuf);
     locator.Register(typeof(HttpClient), restHttp);
     locator.Register(typeof(IServiceProvider), locator);
     locator.Register(typeof(IApplicationProxy), app);
     locator.Register(typeof(ICrudProxy), new CrudProxy(restHttp));
     locator.Register(typeof(IS3Repository), new LitS3Repository(configuration));
     locator.Register(typeof(IDomainProxy), domain);
     locator.Register(typeof(IStandardProxy), new StandardProxy(restHttp, protobuf, app));
     locator.Register(typeof(IReportingProxy), report);
     locator.Register(typeof(ITemplaterService), new ClientTemplaterService(report));
     locator.Register(typeof(ISearchableRepository<>), typeof(ClientSearchableRepository<>));
     locator.Register(typeof(IRepository<>), typeof(ClientRepository<>));
     locator.Register(typeof(IPersistableRepository<>), typeof(ClientPersistableRepository<>));
     locator.Register(typeof(IDomainEventStore), new ClientDomainStore(domain));
     Static.Locator = locator;
     return locator;
 }
예제 #2
0
 /// <summary>
 /// 任务信息打印
 /// </summary>
 /// <param name="info"></param>
 protected void Print(string info)
 {
     if (!string.IsNullOrEmpty(info))
     {
         ApplicationProxy.Singleton().Print($"[{m_jobName}] {info}");
     }
 }
예제 #3
0
        public ApplicationProxy(string id, string customerId, string region,
                                DateTime? dateApplied, DateTime? dateTraved, string offNoteNo, DateTime? offNoteDate,
                                string remark)
        {
            ID = id;
            this.customerId = customerId;
            Region = region;
            DateApplied = dateApplied;
            DateTraved = dateTraved;
            OffNoteDate = offNoteDate;
            OffNoteNo = offNoteNo;
            Remark = remark;

            _original = new ApplicationProxy()
                            {
                                ID = id,
                                customerId = customerId,
                                Region = region,
                                DateApplied = dateApplied,
                                DateTraved = dateTraved,
                                OffNoteDate = offNoteDate,
                                OffNoteNo = offNoteNo,
                                Remark = remark
                            };
        }
예제 #4
0
 public UpdateFoldoutGroup(ApplicationProxy applicationProxy,
                           PackageDatabase packageDatabase,
                           PageManager pageManager)
     : base(new UpdateFoldout(applicationProxy, packageDatabase, pageManager), new MultiSelectFoldout())
 {
     mainFoldout.headerTextTemplate       = L10n.Tr("Update {0}");
     inProgressFoldout.headerTextTemplate = L10n.Tr("Updating {0}...");
 }
예제 #5
0
        /// <summary>
        /// Fulfill the use-case initiated by the given <c>INotification</c>
        /// </summary>
        /// <param name="notification">The <c>INotification</c> to handle</param>
        /// <remarks>
        /// In the Command Pattern, an application use-case typically begins with some user action, which results in an <c>INotification</c> being broadcast, which is handled by business logic in the <c>execute</c> method of an <c>ICommand</c>
        /// </remarks>
        public override void Execute(INotification notification)
        {
            ApplicationProxy appProxy = Facade.RetrieveProxy(ApplicationProxy.NAME) as ApplicationProxy;

            if (appProxy != null)
            {
                appProxy.ViewState = notification.Body.ToString();
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ApplicationMediator"/> class.
        /// </summary>
        /// <param name="viewComponent">The view component.</param>
        public ApplicationMediator(Object viewComponent)
            : base(NAME, viewComponent)
        {
            Facade.RegisterMediator(new LoginViewMediator(Application.LoginView));
            Facade.RegisterMediator(new LoggedInViewMediator(Application.LoggedInView));

            appProxy   = Facade.RetrieveProxy(ApplicationProxy.NAME) as ApplicationProxy;
            loginProxy = Facade.RetrieveProxy(LoginProxy.NAME) as LoginProxy;
        }
예제 #7
0
 protected void OnEnable()
 {
     EditorApplication.modifierKeysChanged += Repaint;
     // when undo or redo is done, we need to reset global tools rotation
     Undo.undoRedoPerformed             += OnSelectionChange;
     UnityConnect.instance.StateChanged += OnUnityConnectStateChanged;
     m_IsPreviewPackagesInUse            = PackageManager.PackageInfo.GetAll().FirstOrDefault(info => info.version.Contains("preview") || info.version.StartsWith("0.")) != null;
     m_PackageManagerPrefs = ServicesContainer.instance.Resolve <PackageManagerPrefs>();
     m_ApplicationProxy    = ServicesContainer.instance.Resolve <ApplicationProxy>();
 }
예제 #8
0
    static void Main(string[] args)
    {
        int version = 0;

        if (int.TryParse(Console.ReadLine(), out version))
        {
            IApplication application = new ApplicationProxy(version);
            Console.WriteLine("Version: {0}", application.Version);
        }
    }
예제 #9
0
        internal void OnEnable()
        {
            m_IsProSkin = EditorGUIUtility.isProSkin;
            EditorApplication.updateMainWindowTitle += UpdateSafeModeTitle;

            m_UpmClient        = ServicesContainer.instance.Resolve <UpmClient>();
            m_SettingsProxy    = ServicesContainer.instance.Resolve <PackageManagerProjectSettingsProxy>();
            m_ApplicationProxy = ServicesContainer.instance.Resolve <ApplicationProxy>();
            RefreshIsPreviewPackagesInUse();

            PackageManager.Events.registeredPackages += RegisteredPackagesEventHandler;
        }
// MARK: - Methods

        public async Task StartAsync <TContext>(
            IHttpApplication <TContext> application,
            CancellationToken cancellationToken)
        {
            _application = new ApplicationProxy <HostingApplication.Context>(
                (IHttpApplication <HostingApplication.Context>)application, () => {
                if (_disposed)
                {
                    throw new ObjectDisposedException(GetType().FullName);
                }
            });

            _httpClientHandler = new ClientHandler(PathString.Empty, _application);

            await _server.StartAsync(_application, cancellationToken);
        }
예제 #11
0
    static void Main(string[] args)
    {
        System.Type activator = typeof(ApplicationProxy);
        AppDomain   domain    =
            AppDomain.CreateDomain(
                "friendly name", null,
                new AppDomainSetup()
        {
            ApplicationName = "application name"
        });
        ApplicationProxy proxy =
            domain.CreateInstanceAndUnwrap(
                Assembly.GetAssembly(activator).FullName,
                activator.ToString()) as ApplicationProxy;

        proxy.DoSomething();
        AppDomain.Unload(domain);
    }
        public PreviewPackagesInUseDropdown()
        {
            m_ApplicationProxy = ServicesContainer.instance.Resolve <ApplicationProxy>();
            m_UpmClient        = ServicesContainer.instance.Resolve <UpmClient>();
            m_SettingsProxy    = ServicesContainer.instance.Resolve <PackageManagerProjectSettingsProxy>();

            name = "PreviewPackagesInUseDropdown";

            AddToClassList("unity-toolbar-button-preview-packages-in-use");

            AddTextElement(this).text = L10n.Tr("Experimental Packages In Use");
            AddIconElement(this);
            AddArrowElement(this);
            clicked += () => ShowUserMenu(worldBound);

            RegisterCallback <GeometryChangedEvent>(OnSizeChanged);
            RegisterCallback <AttachToPanelEvent>(OnAttachedToPanel);
            RegisterCallback <DetachFromPanelEvent>(OnDetachFromPanel);

            RefreshIsPreviewPackagesInUse();
            CheckAvailability();
        }
        public ApplicationsModule() : base("/v1/applications")
        {
            Get[""] = _ => (from x in ApplicationProxy.Instances
                            select new ApplicationModel()
            {
                Created = x.Created,
                Name = x.AppName,
                DialogueCount = x.ActiveDialogues.Count
            }).ToList();

            Post["/{name}"] = args =>
            {
                // Check it doesn't already exist
                if (ApplicationProxy.Instances.Any(x => x.AppName == args.name))
                {
                    return(HttpStatusCode.BadRequest);
                }

                // Add to configuration (doesn't commit)
                ProxyConfig.Current.Applications.Add(args.name);

                // Create new instance
                ApplicationProxy newApp = ApplicationProxy.Create(BackendProvider.Current,
                                                                  new StasisEndpoint(ProxyConfig.Current.AriHostname, ProxyConfig.Current.AriPort, ProxyConfig.Current.AriUsername,
                                                                                     ProxyConfig.Current.AriPassword), args.name);

                return(HttpStatusCode.OK);
            };

            Delete["/{name}"] = args =>
            {
                var app = ApplicationProxy.Instances.SingleOrDefault(x => x.AppName == args.name);
                if (app == null)
                {
                    return(HttpStatusCode.NotFound);
                }

                // Stop App
                ApplicationProxy.Terminate(app);

                return(HttpStatusCode.OK);
            };

            Get["/{name}/dialogues"] = args =>
            {
                var app = ApplicationProxy.Instances.SingleOrDefault(x => x.AppName == args.name);
                if (app == null)
                {
                    return(HttpStatusCode.NotFound);
                }

                return((from d in app.ActiveDialogues
                        select new DialogueModel()
                {
                    Created = d.Created,
                    Id = d.DialogueId.ToString(),
                    Application = args.name,
                    MsgCount = 0
                }).ToList());
            };
        }
예제 #14
0
 public static Stream GetCompiledSqlGrammarStream()
 {
     return(ApplicationProxy.GetManifestResourceStream("PragmaSQL.Proxy.sqlselect.cgt"));
 }
예제 #15
0
 public UpdateFoldout(ApplicationProxy applicationProxy,
                      PackageDatabase packageDatabase,
                      PageManager pageManager)
     : base(new PackageUpdateButton(applicationProxy, packageDatabase, pageManager))
 {
 }