• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Application类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: LayerListWidget

    public LayerListWidget(Application application)
    {
        this.application = application;
        RowSeparatorFunc = OurRowSeparatorFunc;
        ButtonPressEvent += OnButtonPressed;

        VisibilityRenderer visibilityRenderer = new VisibilityRenderer();
        visibilityRenderer.VisibilityChanged += OnVisibilityChange;
        TreeViewColumn visibilityColumn = new TreeViewColumn("Visibility",
                                                             visibilityRenderer);
        visibilityColumn.SetCellDataFunc(visibilityRenderer, (TreeCellDataFunc)VisibilityDataFunc);
        AppendColumn(visibilityColumn);

        CellRendererText TextRenderer = new CellRendererText();
        TreeViewColumn TypeColumn = new TreeViewColumn();
        TypeColumn.PackStart(TextRenderer, true);
        TypeColumn.SetCellDataFunc(TextRenderer, (TreeCellDataFunc)TextDataFunc);
        TypeColumn.Title = "Type";
        AppendColumn(TypeColumn);

        HeadersVisible = false;

        application.SectorChanged += OnSectorChanged;
        application.TilemapChanged += OnTilemapChanged;
        application.LevelChanged += OnLevelChanged;

        FieldOrProperty.AnyFieldChanged += OnFieldModified;
    }
开发者ID:Karkus476,项目名称:supertux-editor,代码行数:28,代码来源:LayerListWidget.cs


示例17: SessionFactory

 public SessionFactory(Application app, MessageStoreFactory storeFactory, LogFactory logFactory, IMessageFactory messageFactory)
 {
     application_ = app;
     messageStoreFactory_ = storeFactory;
     logFactory_ = logFactory;
     messageFactory_ = messageFactory ?? new DefaultMessageFactory();
 }
开发者ID:BobRoss79,项目名称:quickfixn,代码行数:7,代码来源:SessionFactory.cs


示例18: PutApplication

        // PUT api/Applications/5
        public HttpResponseMessage PutApplication(int id, Application application)
        {
            if (!ModelState.IsValid)
            {
                return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState);
            }

            if (id != application.Id)
            {
                return Request.CreateResponse(HttpStatusCode.BadRequest);
            }

            db.Entry(application).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException ex)
            {
                return Request.CreateErrorResponse(HttpStatusCode.NotFound, ex);
            }

            return Request.CreateResponse(HttpStatusCode.OK);
        }
开发者ID:nathanfl,项目名称:AAHIPro,代码行数:26,代码来源:ApplicationsController.cs


示例19: Setup

        public void Setup()
        {
            _application = LaunchApplication();
            _horizonWindow = FindMainWindow();

            CustomCommandSerializer.AddKnownTypes(typeof(Background));
        }
开发者ID:abolourian,项目名称:WhiteCustomCommands,代码行数:7,代码来源:MyTextBoxTests.cs


示例20: MyClassInitialize

		public static void MyClassInitialize(TestContext testContext)
		{
			if (!Directory.Exists(Utility.RootFolder))
			{
				Directory.CreateDirectory(Utility.RootFolder);
			}
			if (!Directory.Exists(Utility.TempFolder))
			{
				Directory.CreateDirectory(Utility.TempFolder);
			}
			_mXmlNs = Utility.NS;
			_mOnGenerator = new OneNoteGenerator(Utility.RootFolder);
			//Get Id of the test notebook so we chould retrieve generated content
			//KindercareFormatConverter will create notebookName as Kindercare
			_mNotebookId = _mOnGenerator.CreateNotebook(NotebookName);

			var word = new Application();
			var doc = word.Application.Documents.Add();

			//add pages to doc
			for (int i = 1; i < DocPageTitles.Count; i++)
			{
				doc.Content.Text += DocPageTitles[i];
				doc.Words.Last.InsertBreak(WdBreakType.wdPageBreak);
			}

			var filePath = TestDocPath as object;
            doc.SaveAs(ref filePath);
            ((_WordDocument)doc).Close();
            ((_WordApplication)word).Quit();
		}
开发者ID:OneNoteDev,项目名称:OneNoteConversionTool,代码行数:31,代码来源:GenericFormatConverterUnitTest.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ApplicationClass类代码示例发布时间:2022-05-24
下一篇:
C# AppTypes类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap