当前位置: 首页>>代码示例>>C#>>正文


C# Application类代码示例

本文整理汇总了C#中Application的典型用法代码示例。如果您正苦于以下问题:C# Application类的具体用法?C# Application怎么用?C# Application使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Application类属于命名空间,在下文中一共展示了Application类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ExecuteWork

        // The sheets of the workbook are:
        // Sheet number 1: INPUTS
        // Sheet number 2: OUTPUTS
        // Sheet number 3: Cover
        // Sheet number 4: Amendment Record
        // Sheet number 5: Reference documents
        // Sheet number 6: Introduction
        // Sheet number 7: ETCS DMI inputs => to import
        // Sheet number 8: ETCS DMI outputs => to import
        // Sheet number 9: INPUT ITEMS
        // Sheet number 10: OUTPUT ITEMS
        // Sheet number 11: ANALYSIS
        /// <summary>
        ///     Launches import of the excel file in the background task
        /// </summary>
        /// <param name="arg"></param>
        public override void ExecuteWork()
        {
            if (TheDictionary != null)
            {
                Application application = new Application();
                if (application != null)
                {
                    Workbook workbook = application.Workbooks.Open(FileName);
                    if (workbook.Sheets.Count == 11)
                    {
                        Specification newSpecification = (Specification) acceptor.getFactory().createSpecification();
                        newSpecification.Name = "Start Stop Conditions";
                        TheDictionary.appendSpecifications(newSpecification);

                        Chapter newChapter = (Chapter) acceptor.getFactory().createChapter();
                        newChapter.setId("1 - DMI inputs");
                        newSpecification.appendChapters(newChapter);
                        Worksheet aWorksheet = workbook.Sheets[7] as Worksheet;
                        importParagraphs(newChapter, "1", aWorksheet);

                        newChapter = (Chapter) acceptor.getFactory().createChapter();
                        newChapter.setId("2 - DMI outputs");
                        newSpecification.appendChapters(newChapter);
                        aWorksheet = workbook.Sheets[8] as Worksheet;
                        importParagraphs(newChapter, "2", aWorksheet);
                    }
                    workbook.Close(false);
                }
                else
                {
                    Log.ErrorFormat("Error while opening the excel file");
                }
                application.Quit();
            }
        }
开发者ID:JamesOakey,项目名称:ERTMSFormalSpecs,代码行数:51,代码来源:SpecsImporter.cs

示例2: Main

 static void Main(string[] args)
 {
     try
     {                
         Application oApp = null;
         if (args.Length < 1)
             oApp = new Application();
         else
             oApp = new Application(args[0]);
         Application.SBO_Application.StatusBar.SetSystemMessage("Start installing UDO's", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Success);
         AddonInfoInfo.InstallUDOs();
         Application.SBO_Application.StatusBar.SetSystemMessage("UDO's installed successfully", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Success);
         Menu MyMenu = new Menu();
         AddonInfoInfo.SetFormFilter();
         Application.SBO_Application.StatusBar.SetSystemMessage("Adding menus", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Success);
         MyMenu.AddMenuItems();
         Application.SBO_Application.StatusBar.SetSystemMessage("Menus Added Successfully", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Success);
         Application.SBO_Application.StatusBar.SetSystemMessage("Register listeners", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Success);
         var bListeners = new ApplicationHandlers();
         Application.SBO_Application.StatusBar.SetSystemMessage("Items Transfer Add-on installed successfully.", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Success);
         oApp.Run();
     }
     catch (Exception ex)
     {
         Utilities.LogException(ex);
     }
     
 }
开发者ID:HoussamSaghir,项目名称:ITCO,代码行数:28,代码来源:Program.cs

示例3: ExcelViewProvider

 public ExcelViewProvider(Application excelApplication)
 {
     workbooks = new Dictionary<Workbook, List<Window>>();
     this.excelApplication = excelApplication;
     var monitor = new WorkbookClosedMonitor(excelApplication);
     monitor.WorkbookClosed += MonitorWorkbookClosed;
 }
开发者ID:huangchao-shanghai,项目名称:VSTOContrib,代码行数:7,代码来源:ExcelViewProvider.cs

示例4: ChannelsViewForm

        private Mutex mutex = null; // синхронизатор

        #endregion Fields

        #region Constructors

        public ChannelsViewForm(Application _app)
        {
            app = _app;
            InitializeComponent();

            mutex = new Mutex();
        }
开发者ID:slawer,项目名称:devicemanager,代码行数:13,代码来源:ChannelsViewForm.cs

示例5: WordDocTargetHost

        public WordDocTargetHost(Application app)
        {
            _app = app;

            _app.DocumentOpen += OnMsWordDocumentOpen;
            _app.DocumentBeforeClose += OnMsWordDocumentBeforeClose;
        }
开发者ID:killbug2004,项目名称:WSProf,代码行数:7,代码来源:WordDocTarget.cs

示例6: Main

        static void Main(string[] args)
        {
            try
            {
                Application oApp = null;
                if (args.Length < 1)
                {
                    oApp = new Application();
                }
                else
                {
                    oApp = new Application(args[0]);
                }

                Menu MyMenu = new Menu();
                MyMenu.AddMenuItems();
                oApp.RegisterMenuEventHandler(MyMenu.SBO_Application_MenuEvent);
                Application.SBO_Application.AppEvent += new SAPbouiCOM._IApplicationEvents_AppEventEventHandler(SBO_Application_AppEvent);
               // openGRPO();
             //  updateLandedCost();
                //testLandedCost();
                AddLandedCostXML();
                oApp.Run();
            }
            catch (Exception ex)
            {
                //SAPbobsCOM.Company oCompany = Application.SBO_Application.Company.GetDICompany() as SAPbobsCOM.Company;
                //string s = oCompany.GetLastErrorDescription();
                System.Windows.Forms.MessageBox.Show(ex.Message);
            }
        }
开发者ID:Ryan-Zebian,项目名称:B1_LandedCostTesting,代码行数:31,代码来源:Program.cs

示例7: AddChildNodesToGroupTest

        public void AddChildNodesToGroupTest()
        {
            Application application = new Application();

            try
            {
                // Where ever we are creating object for WorkflowController_Accessor, we need to set the ThisAddIn_Accessor.ExcelApplication to
                // wither null or actual application object.
                ThisAddIn_Accessor.ExcelApplication = application;

                Group childGroup = new Group("Earth", GroupType.ReferenceFrame, null);
                Layer layer = new Layer();
                layer.Name = "Layer1";
                layer.Group = childGroup;
                LayerMap_Accessor localLayerMap = new LayerMap_Accessor(layer);
                localLayerMap.MapType = LayerMapType.Local;

                GroupChildren groupChild = LayerMapExtensions_Accessor.AddChildNodesToGroup(localLayerMap);
                Assert.AreEqual("Earth", groupChild.Name);
                Assert.AreEqual(1, groupChild.AllChildren.Count);
                Assert.AreEqual(1, groupChild.Layers.Count);
                foreach (Layer layerVal in groupChild.Layers)
                {
                    Assert.AreEqual("Layer1", layerVal.Name);
                }
            }
            finally
            {
                application.Close();
            }
        }
开发者ID:rat-s-tar,项目名称:wwt-excel-plugin,代码行数:31,代码来源:LayerMapExtensionsTest.cs

示例8: Startup

    static Startup()
    {
        CommandModel commandModel =
            new CommandModel("sc").AddArgument("port", new CommandArgument("type", "number"))
                                  .AddArgument("path", new CommandArgument("type", "string"))
                                  .AddArgument("logs", new CommandArgument("type", "boolean"));

        ApplicationOptions options;
        try {
            options = (ApplicationOptions)CommandLine.Parse(commandModel);
            options.Port = Script.Or(options.Port, Number.ParseInt(Node.Process.Environment["PORT"]), 1337);
            options.Path = Script.Or(options.Path, Node.Process.GetCurrentDirectory());

            Runtime.EnableTrace = options.Logs;
        }
        catch (Exception e) {
            Console.Log(e.Message);
            Console.Log(commandModel.ToString());

            return;
        }

        Application app = new Application(options);
        app.Run();
    }
开发者ID:nikhilk,项目名称:simplecloud,代码行数:25,代码来源:Startup.cs

示例9: ExportToExcel

        public void ExportToExcel(object sender, EventArgs e)
        {
            var tableRow = _table.Rows;
            //Open Excel and get worksheet
            var app = new Application();
            var workbook = app.Workbooks.Add();
            var worksheet = workbook.Worksheets[1] as Microsoft.Office.Interop.Excel.Worksheet;
            //Add headers
            worksheet.Cells[1, 1] = "Reference #";
            worksheet.Cells[1, 2] = "Part #";
            worksheet.Cells[1, 3] = "Description | Serial #";
            worksheet.Cells[1, 4] = "Quantity";
            worksheet.Cells[1, 5] = "Additional Information";

            for (int x = 0; x < _table.Rows.Count; x++)
            {
                worksheet.Cells[x + 2, 1] = tableRow[x].ItemArray[0];
                worksheet.Cells[x + 2, 2] = tableRow[x].ItemArray[1];
                worksheet.Cells[x + 2, 3] = tableRow[x].ItemArray[2];
                worksheet.Cells[x + 2, 4] = tableRow[x].ItemArray[3];
                worksheet.Cells[x + 2, 5] = tableRow[x].ItemArray[4];
            }
                //save
            gvDetails.DataSource = _table;
            gvDetails.DataBind();
            HttpContext.Current.Session["name"] = _table;

            //Response.WriteFile(workbook.SaveAs("C:\\test2.xlsx"));
        }
开发者ID:cayala,项目名称:Portfolio,代码行数:29,代码来源:ExampleWF.aspx.cs

示例10: TestDomainAdminAccessOtherDomain

        public void TestDomainAdminAccessOtherDomain()
        {
            Account account = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "[email protected]", "test");
             account.AdminLevel = eAdminLevel.hAdminLevelDomainAdmin;
             account.Save();

             SingletonProvider<TestSetup>.Instance.AddDomain("example.com");

             var newApplication = new Application();
             newApplication.Authenticate("[email protected]", "test");
             Assert.AreEqual(1, newApplication.Domains.Count);

             Domains domains = SingletonProvider<TestSetup>.Instance.GetApp().Domains;
             Assert.AreEqual(2, domains.Count);

             try
             {
            Domain secondDomain = newApplication.Domains.get_ItemByName("example.com");
            Assert.Fail("Was able to access other domain.");
             }
             catch (COMException ex)
             {
            Assert.IsTrue(ex.Message.Contains("Invalid index."));
             }
        }
开发者ID:SpivEgin,项目名称:hmailserver,代码行数:25,代码来源:Security.cs

示例11: FirstWhileWaiting

        public void FirstWhileWaiting()
        {
            var trigger = true;
            var expected = TestHelper.CreateElement("Expected", "Expected");
            var application = new Application(null);
            var host = TestHelper.CreateMock<ElementHost>(application, null);
            var element = TestHelper.CreateElement("Root", "Root", host.Object);

            host.Object.Application.Timeout = TimeSpan.FromSeconds(1);

            host.Setup(x => x.Refresh())
                .Returns(() =>
                {
                    trigger = !trigger;
                    if (trigger)
                    {
                        host.Object.Children.Add(expected);
                    }

                    return host.Object;
                });

            var actual = host.Object.First(expected.Id);
            Assert.IsNotNull(actual);
            Assert.AreEqual(expected, actual);
        }
开发者ID:BobbyCannon,项目名称:TestR,代码行数:26,代码来源:ElementTests.cs

示例12: Initialize

        public override void Initialize(ContentRepository.Content context, string backUri, Application application, object parameters)
        {
            base.Initialize(context, backUri, application, parameters);

            //if (string.Compare(PortalContext.Current.AuthenticationMode, "windows", StringComparison.CurrentCultureIgnoreCase) != 0)
            //    this.Forbidden = true;
        }
开发者ID:maxpavlov,项目名称:FlexNet,代码行数:7,代码来源:WebdavBrowseAction.cs

示例13: WordOpen

 bool WordOpen(string file)
 {
     var tmp = CopyFile(file);
     var application = new Application();
     using (new ComRelease(application))
     {
         try
         {
             var documents = application.Documents;
             using (new ComRelease(documents))
             {
                 var document = documents.Open(tmp);
                 using (new ComRelease(document))
                 {
                     object saveChanges = WdSaveOptions.wdDoNotSaveChanges;
                     document.Close(ref saveChanges);
                     return true;
                 }
             } 
         }
         finally
         {
            application.Quit();
            File.Delete(tmp);
         }
     }
 }
开发者ID:killbug2004,项目名称:WSProf,代码行数:27,代码来源:TestWordXCleaningStrategy.cs

示例14: Guards

    public async void Guards()
    {
        Application application = new Application("OrchestrateApiKey");
        var client = new Client(application);

        var exception = await Assert.ThrowsAsync<ArgumentException>(
            () => client.CreateCollectionAsync(string.Empty, string.Empty, string.Empty)
        );
        Assert.Equal("collectionName", exception.ParamName);

        exception = await Assert.ThrowsAsync<ArgumentNullException>(
            () => client.CreateCollectionAsync(null, string.Empty, string.Empty)
        );
        Assert.Equal("collectionName", exception.ParamName);

        exception = await Assert.ThrowsAsync<ArgumentException>(
            () => client.CreateCollectionAsync(collectionName, string.Empty, string.Empty)
        );
        Assert.Equal("key", exception.ParamName);

        exception = await Assert.ThrowsAsync<ArgumentNullException>(
            () => client.CreateCollectionAsync(collectionName, null, string.Empty)
        );
        Assert.Equal("key", exception.ParamName);

        exception = await Assert.ThrowsAsync<ArgumentNullException>(
            () => client.CreateCollectionAsync<object>(collectionName, "jguid", null)
        );
        Assert.Equal("item", exception.ParamName);
    }
开发者ID:nstetich,项目名称:Orchestrate-.NET-SDK,代码行数:30,代码来源:CreateCollectionTests.cs

示例15: ImportDataFile

        public void ImportDataFile(ClassDataFile file)
        {
            try
            {
                string newFileLoc = this.UpdateTemplate(file);
                Application app = new Application();
                Package package = null;
                //Load the SSIS Package which will be executed
                package = app.LoadPackage(newFileLoc, null);
                //Pass the varibles into SSIS Package

                //Execute the SSIS Package and store the Execution Result
                Microsoft.SqlServer.Dts.Runtime.DTSExecResult results = package.Execute();
                //Check the results for Failure and Success
                if (results == Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure)
                {
                    string err = "";
                    foreach (Microsoft.SqlServer.Dts.Runtime.DtsError local_DtsError in package.Errors)
                    {
                        string error = local_DtsError.Description.ToString();
                        err = err + error;
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
开发者ID:RvdMerweJHB,项目名称:Shampoo-Meter,代码行数:29,代码来源:ClassSSISPackage.cs


注:本文中的Application类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。