示例#1
0
        /// <summary>
        /// Generates the registry file.
        /// </summary>
        /// <param name="application">The custom application that should be within the registry file.</param>
        public void GenerateRegistryFile(CustomApplication application)
        {
            // Sanity.
            if (null == application)
            {
                throw new ArgumentNullException(nameof(application));
            }

            // Let them choose a file.
            if (this.saveFileDialog.ShowDialog(this.Window) != true)
            {
                return;
            }

            // Does it exist?
            var fileInfo = new System.IO.FileInfo(this.saveFileDialog.FileName);

            if (fileInfo.Exists)
            {
                fileInfo.Delete();
            }

            // Create it.
            using (var textWriter = fileInfo.CreateText())
            {
                textWriter.WriteLine("Windows Registry Editor Version 5.00");
                textWriter.WriteLine();
                textWriter.WriteLine($@"[HKEY_LOCAL_MACHINE\SOFTWARE\Motive\M-Files\{this.SelectedVault.GetServerVersionOfVault().Display}\Client\MFClient\ApplicationAccess\{this.SelectedVault.GetGUID()}]");
                textWriter.WriteLine($"\"{application.ID}\"=\"{application.ChecksumHash}\"");
            }
        }
示例#2
0
 public List <CustomApplication> findCustomApplicationsWithCondition(int condition)
 {
     try
     {
         using (APTECH_SEM_3Entities db = new APTECH_SEM_3Entities())
         {
             var selectedApplications      = (from p in db.GET_RESULT_WITH_APPLY() select p).ToList();
             List <CustomApplication> list = new List <CustomApplication>();
             if (selectedApplications != null)
             {
                 foreach (var a in selectedApplications)
                 {
                     if (a.APPROVE_STATUS == condition)
                     {
                         CustomApplication application = new CustomApplication()
                         {
                             APPLY_ID = a.APPLY_ID, NAME = a.NAME, APPROVE_STATUS = a.APPROVE_STATUS, TEST_INDEX = a.TEST_INDEX, TEST_RESULT_1 = a.TEST_RESULT_1, TEST_RESULT_2 = a.TEST_RESULT_2, TEST_RESULT_3 = a.TEST_RESULT_3
                         };
                         list.Add(application);
                     }
                 }
             }
             return(list);
         }
     }
     catch (Exception ex)
     {
         throw;
     }
 }
示例#3
0
        public void ShouldGetConfiguration()
        {
            IApplication app = new CustomApplication(this);

            app.ConfigurationValue("A").Should().Be("A");

            app = new CustomApplication();
            new Action(() => app.ConfigurationValue("A")).ShouldThrow <InvalidOperationException>();
        }
示例#4
0
        static void Main()
        {
            Application application = new CustomApplication
            {
                ShutdownMode = ShutdownMode.OnExplicitShutdown
            };

            application.Run();
        }
示例#5
0
        public void ShouldExecuteControllerAndHaveLogging()
        {
            var router = FakeRouter.Create(typeof(ParentController).GetClass().As <IRenderingController>());

            var application = new CustomApplication();

            var inMemoryLogger = new InMemoryLogger(LogLevels.Always);

            application.SetInstance <ILogger>(x => inMemoryLogger);

            var     a      = new ControllerExecutionManager(application, router);
            IResult rezult = a.ExecuteController(this.CreateContext(a.Application, inMemoryLogger));

            rezult.Content.BodyAsString.Should().Be("Parent Begin->ChildController<- End");
            inMemoryLogger.Messages.Length.Should().BeGreaterThan(0);
        }
示例#6
0
        public void ShouldCreateRouter()
        {
            IApplication app = new CustomApplication(this);

            app.CreateRouter().Should().NotBeNull().And.BeAssignableTo <NullRouter>();
        }