/// <summary> /// Update the Application object /// </summary> internal static void Save(Application app, string server) { WqlConnectionManager connection = CMConnection.Connect(server); ApplicationFactory applicationFactory = new ApplicationFactory(); AppManWrapper applicationWrapper = AppManWrapper.Create(connection, applicationFactory) as AppManWrapper; applicationWrapper.InnerAppManObject = app; applicationFactory.PrepareResultObject(applicationWrapper); applicationWrapper.InnerResultObject.Put(); }
/// <summary> /// Return a single Application object /// </summary> internal static Application GetApplicationByName(string name, string server) { NamedObject.DefaultScope = "xCM"; WqlConnectionManager connectionManager = CMConnection.Connect(server); IResultObject applications = connectionManager.QueryProcessor.ExecuteQuery("SELECT * FROM SMS_Application WHERE LocalizedDisplayName='" + name + "' AND IsLatest=1"); // this should only return one result, but we need to perform a Get() to retrieve the lazy properties IResultObject application = null; foreach (IResultObject result in applications) { result.Get(); // tip : make sure the CI_ID is not in single quotes, for example, SMS_Application.CI_ID='123456' application = connectionManager.GetInstance(@"SMS_Application.CI_ID=" + result["CI_ID"].IntegerValue); } ApplicationFactory applicationFactory = new ApplicationFactory(); AppManWrapper applicationWrapper = AppManWrapper.WrapExisting(application, applicationFactory) as AppManWrapper; return applicationWrapper.InnerAppManObject as Application; }
public PhoneControllerTests(ApplicationFactory factory) : base(factory) { }
public bool CheckEnability(ApplicationFactory AppFactory, InteropExcel.Workbook ActiveWorkbook) { _IsEnabled = true; _AppFactory = AppFactory; if (ActiveWorkbook != null) { _ActiveWorkbook = ActiveWorkbook; _ExcelApplication = ActiveWorkbook.Application; } if (this.ModuleType == PSAddinModules.ModuleType.Workbook) { if (ActiveWorkbook == null) { _IsEnabled = false; } else { if (!ExcelToSql.Functions.Excel.HasDocumentProperty(ActiveWorkbook, this.Name)) { _IsEnabled = false; } } } return _IsEnabled; }
public UserControllerTest(ApplicationFactory <Startup> factory) { _factory = factory; }
public CreateSessionResponseModel CreateSession(CreateSessionRequestModel model) { try { ApplicationFactory.LogWithObject($@"BL_CreateGame > CreateSession start.", model); ApplicationFactory.ValidateRequestModel(new CreateSessionRequestModelValidator(), model); //refactor using validator if (model.Name.Length > 10) { //result.Message = "Player name has maximum length of 10 characters."; //throw new Exception(result.Message); } } catch (Exception ex) { ApplicationFactory.CurrentLogger.Error($"BL_CreateGame > CreateSession error. {ex.Message}"); //return structured response } CreateSessionResponseModel result = new CreateSessionResponseModel() { SessionPin = "0" }; try { var sessionPin = GenerateRandomNo().ToString(); var currentTime = DateTime.Now; T_Game_Sessions newGame = new T_Game_Sessions() { SessionPin = sessionPin, CreateTime = currentTime, SessionIsActive = true }; db.T_Game_Sessions.Add(newGame); db.SaveChanges(); T_Game_Session_Players gameLeader = new T_Game_Session_Players() { SessionId = newGame.SessionId, PlayerName = model.Name, JoinTime = currentTime, DeviceId = model.DeviceId, RequestAppId = model.AppId, }; db.T_Game_Session_Players.Add(gameLeader); db.SaveChanges(); result.SessionPin = sessionPin; } catch (Exception ex) { ApplicationFactory.CurrentLogger.Error($"BL_CreateGame > CreateSession error. {ex.Message}"); //return structured response } ApplicationFactory.LogWithObject($"BL_CreateGame > CreateSession success.", result); return(result); }
public CustomerControllerTests(ApplicationFactory factory) : base(factory) { }
public ApplicationController(ApplicationFactory applicationsFactory) : base(applicationsFactory, "applications", ResourceMapper) { }
public RoomsDistribution(Form parentForm) { InitializeComponent(); ParentForm = parentForm; phaseThreeController = ApplicationFactory.GetPhaseThreeController(); }
static ApplicationRegistry() { ApplicationFactory.Instance().Register(new DirectoryApplication()); }
/// <summary> /// Creates the test application for authentication. /// </summary> /// <param name="configureServices">An optional method to configure additional application services.</param> /// <returns> /// The test application to use for authentication. /// </returns> protected WebApplicationFactory <Program> CreateTestServer(Action <IServiceCollection>?configureServices = null) => ApplicationFactory.CreateApplication(this, configureServices);
internal void BuildObjectGraph(Action shutdown) { ValidateCommandLineArguments(); InitializeLogging(); InitializeText(); context = new ClientContext(); uiFactory = BuildUserInterfaceFactory(); actionCenter = uiFactory.CreateActionCenter(); messageBox = BuildMessageBox(); nativeMethods = new NativeMethods(); runtimeProxy = new RuntimeProxy(runtimeHostUri, new ProxyObjectFactory(), ModuleLogger(nameof(RuntimeProxy)), Interlocutor.Client); systemInfo = new SystemInfo(); taskbar = uiFactory.CreateTaskbar(ModuleLogger("Taskbar")); taskview = uiFactory.CreateTaskview(); var processFactory = new ProcessFactory(ModuleLogger(nameof(ProcessFactory))); var applicationMonitor = new ApplicationMonitor(TWO_SECONDS, ModuleLogger(nameof(ApplicationMonitor)), nativeMethods, processFactory); var applicationFactory = new ApplicationFactory(applicationMonitor, ModuleLogger(nameof(ApplicationFactory)), nativeMethods, processFactory); var displayMonitor = new DisplayMonitor(ModuleLogger(nameof(DisplayMonitor)), nativeMethods, systemInfo); var explorerShell = new ExplorerShell(ModuleLogger(nameof(ExplorerShell)), nativeMethods); var fileSystemDialog = BuildFileSystemDialog(); var hashAlgorithm = new HashAlgorithm(); var splashScreen = uiFactory.CreateSplashScreen(); var systemMonitor = new SystemMonitor(ModuleLogger(nameof(SystemMonitor))); var operations = new Queue <IOperation>(); operations.Enqueue(new I18nOperation(logger, text)); operations.Enqueue(new RuntimeConnectionOperation(context, logger, runtimeProxy, authenticationToken)); operations.Enqueue(new ConfigurationOperation(context, logger, runtimeProxy)); operations.Enqueue(new DelegateOperation(UpdateAppConfig)); operations.Enqueue(new LazyInitializationOperation(BuildClientHostOperation)); operations.Enqueue(new ClientHostDisconnectionOperation(context, logger, FIVE_SECONDS)); operations.Enqueue(new LazyInitializationOperation(BuildKeyboardInterceptorOperation)); operations.Enqueue(new LazyInitializationOperation(BuildMouseInterceptorOperation)); operations.Enqueue(new ApplicationOperation(context, applicationFactory, applicationMonitor, logger, text)); operations.Enqueue(new DisplayMonitorOperation(context, displayMonitor, logger, taskbar)); operations.Enqueue(new SystemMonitorOperation(context, systemMonitor, logger)); operations.Enqueue(new LazyInitializationOperation(BuildShellOperation)); operations.Enqueue(new LazyInitializationOperation(BuildBrowserOperation)); operations.Enqueue(new LazyInitializationOperation(BuildServerOperation)); operations.Enqueue(new ClipboardOperation(context, logger, nativeMethods)); var sequence = new OperationSequence(logger, operations); ClientController = new ClientController( actionCenter, applicationMonitor, context, displayMonitor, explorerShell, fileSystemDialog, hashAlgorithm, logger, messageBox, sequence, runtimeProxy, shutdown, splashScreen, systemMonitor, taskbar, text, uiFactory); }
public Host(Application application, CustomTaskPaneCollection customTaskPanes, ApplicationFactory applicationFactory) { this.Application = application; this.CustomTaskPanes = customTaskPanes; this.ApplicationFactory = applicationFactory; this.VstoWorksheetByInteropWorksheet = new Dictionary <Microsoft.Office.Interop.Excel.Worksheet, Worksheet>(); this.VstoWorkbookByInteropWorkbook = new Dictionary <Microsoft.Office.Interop.Excel.Workbook, Workbook>(); }
public static void RunModuleEventHandler(ApplicationFactory AppFactory, InteropExcel.Workbook ActiveWorkbook, ModuleEventHandler Handler, object[] parameters) { foreach (var item in _ModuleList) { if (item.Value.CheckEnability(AppFactory, ActiveWorkbook)) { MethodInfo mi = TryGetModuleEventHandler(item.Value, Handler); if (mi != null) { mi.Invoke(item.Value, parameters); } } } }
public AddInManager(Application application, CustomTaskPaneCollection customTaskPanes, ApplicationFactory factory) { this.application = application; this.customTaskPanes = customTaskPanes; this.factory = factory; }
public static void EnableModules(ApplicationFactory _AppFactory, InteropExcel.Workbook ActiveWorkbook) { _ActiveWorkbook = ActiveWorkbook; foreach (var item in _ModuleList) { if (item.Value.CheckEnability(_AppFactory,ActiveWorkbook)) { item.Value.EnableModule(true); item.Value.InitModuleObjectRanges(ActiveWorkbook, true); } else { item.Value.EnableModule(false); } } }
public static void ProcessAADObjects([TimerTrigger("0 0 1 * * 1-5")] TimerInfo info, TextWriter log) // 01:00 every weekday { try { AdalClient client = new AdalClient(appConfig, CredentialType.Client, null); var appFactory = new ApplicationFactory(); var appManager = appFactory.CreateInstance(client); var appsExpiringSoon = appManager.GetExpiredApplicationInDays(appConfig.NotificationInterval); var appsExpired = appManager.GetAllExpired(); var spFactory = new ServicePrincipalFactory(); var spManager = spFactory.CreateInstance(client); var spExpiringSoon = spManager.GetExpiredPrincipalsInDays(appConfig.NotificationInterval); var spExpired = spManager.GetExpiredPrincipals(); if (appsExpiringSoon.Count > 0 || appsExpired.Count > 0 || spExpiringSoon.Count > 0 || spExpired.Count > 0) { // Create the Connector Card payload var card = new ConnectorCard { Summary = "Expiring Credential Status", Title = "PnP Tools - Tenant Information Portal", Text = "The credentials for the following have expired or will expire soon.", ThemeColor = "#FF0000" }; card.PotentialAction.Add( new ViewAction { Name = "View in Tenant Information Portal", Target = new string[] { appConfig.PortalUrl } } ); List <Fact> facts = null; if (appsExpiringSoon.Count > 0) { facts = appsExpiringSoon.Select(a => new Fact { Name = a.DiplayName, Value = a.EndDate.ToString() }).ToList(); card.Sections.Add(CreateSection($"Applications Expiring Soon ({appConfig.NotificationInterval}) days", ExpiringSoonImage, facts)); } if (appsExpired.Count > 0) { facts = appsExpired.Select(a => new Fact { Name = a.DiplayName, Value = a.EndDate.ToString() }).ToList(); card.Sections.Add(CreateSection("Applications Expired", ExpiredImage, facts)); } if (spExpiringSoon.Count > 0) { facts = spExpiringSoon.Select(sp => new Fact { Name = sp.DisplayName, Value = sp.EndDate.ToString() }).ToList(); card.Sections.Add(CreateSection($"Service Principals Expiring Soon ({appConfig.NotificationInterval}) days", ExpiringSoonImage, facts)); } if (spExpired.Count > 0) { facts = spExpired.Select(sp => new Fact { Name = sp.DisplayName, Value = sp.EndDate.ToString() }).ToList(); card.Sections.Add(CreateSection("Service Principals Expired", ExpiredImage, facts)); } var requestBody = JsonConvert.SerializeObject(card, null, new JsonSerializerSettings { ContractResolver = new CamelCasePropertyNamesContractResolver() }); // Make POST to webhook URL var status = HttpHelper.PostJsonMessage(appConfig.ConnectorUrl, requestBody); } } catch (Exception ex) { log.Write(ex.ToString()); } }