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

C# Windows.Application类代码示例

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

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



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

示例1: PlatformWpf

        public PlatformWpf()
            : base(null, true)
        {
            var app = new Application ();
            var slCanvas = new Canvas ();
            var win = new Window
            {
                Title = Title,
                Width = Width,
                Height = Height,
                Content = slCanvas
            };

            var cirrusCanvas = new CirrusCanvas(slCanvas, Width, Height);
            MainCanvas = cirrusCanvas;

            win.Show ();

            EntryPoint.Invoke (null, null);

            var timer = new DispatcherTimer ();
            timer.Tick += runDelegate;
            timer.Interval = TimeSpan.FromMilliseconds (1);

            timer.Start ();
            app.Run ();
        }
开发者ID:chkn,项目名称:cirrus,代码行数:27,代码来源:Bootstrap.cs


示例2: Main

		public static void Main()
		{
			// original (doesn't work with snoop, well, can't find a window to own the snoop ui)
			Window window = new Window();
			window.Title = "Say Hello";
			window.Show();

			Application application = new Application();
			application.Run();


			// setting the MainWindow directly (works with snoop)
//			Window window = new Window();
//			window.Title = "Say Hello";
//			window.Show();
//
//			Application application = new Application();
//			application.MainWindow = window;
//			application.Run();


			// creating the application first, then the window (works with snoop)
//			Application application = new Application();
//			Window window = new Window();
//			window.Title = "Say Hello";
//			window.Show();
//			application.Run();


			// creating the application first, then the window (works with snoop)
//			Application application = new Application();
//			Window window = new Window();
//			window.Title = "Say Hello";
//			application.Run(window);
		}	}
开发者ID:JonGonard,项目名称:snoopwpf,代码行数:35,代码来源:Main.cs


示例3: Main

		public static void Main()
		{
			Application app = new Application();
			Application.Current.ShutdownMode = ShutdownMode.OnMainWindowClose;
			app.Startup += new StartupEventHandler(app_Startup);
			app.Run();
		}
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:7,代码来源:Program.cs


示例4: UserAccountControlService

        /// <summary>
        /// Create a new instance of the <see cref="UserAccountControlService"/>.
        /// </summary>
        /// <param name="application">
        /// An instance of the current <see cref="Application"/> object.
        /// The service will use this to perform shutdown and re-launch operations.
        /// </param>
        public UserAccountControlService(Application application)
        {
            if (application == null)
                throw new ArgumentNullException("application");

            Application = application;
        }
开发者ID:btowntkd,项目名称:WpfUtils,代码行数:14,代码来源:UserAccountControlService.cs


示例5: ConvertToBitmapSource

        public ConvertToBitmapSource()
        {
            BitmapSource bs = null;

            // OpenCVによる画像処理 (Threshold)
            using (IplImage src = new IplImage(Const.ImageLenna, LoadMode.GrayScale))
            using (IplImage dst = new IplImage(src.Size, BitDepth.U8, 1))
            {
                src.Smooth(src, SmoothType.Gaussian, 5);
                src.Threshold(dst, 0, 255, ThresholdType.Otsu);
                // IplImage -> BitmapSource
                bs = dst.ToBitmapSource();
                //bs = BitmapSourceConverter.ToBitmapSource(dst);
            }

            // WPFのWindowに表示してみる
            Image image = new Image { Source = bs };
            Window window = new Window
            {
                Title = "from IplImage to BitmapSource",
                Width = bs.PixelWidth,
                Height = bs.PixelHeight,
                Content = image
            };

            Application app = new Application();
            app.Run(window);
        }
开发者ID:neoxeo,项目名称:opencvsharp,代码行数:28,代码来源:ConvertToBitmapSource.cs


示例6: UiThread

 public static void UiThread(object arg)
 {
     var app = new Application();
     var window = new MainWindow();
     window.onClosed += window_onClosed;
     app.Run(window);
 }
开发者ID:jaredrad,项目名称:EmailPrinter,代码行数:7,代码来源:Program.cs


示例7: Main

        static void Main(string[] args)
        {
            Standard s1 = new Standard("ГОСТ Р 21.1101-2009");
            Standard s2 = new Standard("ГОСТ", "2.101");
            HashSet<Standard> sl1 = new HashSet<Standard>();
            HashSet<Standard> sl2 = new HashSet<Standard>();

            sl1.Add(s1);
            sl1.Add(s2);

            string[] test = { "tesT", "best", "rest" };
            IEnumerable<string> tt = test.Take(test.Length - 1).ToList();

            ConfigManager.ConfigManager cm = ConfigManager.ConfigManager.Instance;
            HashSet<Document> s1d = s1.Check();
            Console.WriteLine(s1d.First());

            string str = "333-ГОСТ--444";
            Console.WriteLine(str.cleanAllWithWhiteList());
            NormaCS ncs = new NormaCS(sl1);
            ncs.checkStandards();

            ReportWindow.Main mn = new ReportWindow.Main(ncs.Documents);

            Application app = new Application();
            app.Run(mn);
        }
开发者ID:alexeispirit,项目名称:NormaCSBinder,代码行数:27,代码来源:Program.cs


示例8: Main

        public static void Main() {
            var boardUi = new BoardUI();
            var interactors = new Interactors();
            var sync = new Synchronizer<IEnumerable<Task>>();

            // Start
            var columns_and_tasks = interactors.Start();
            boardUi.Setup_Board(columns_and_tasks);

            // Refresh
            sync.Result += tasks => boardUi.Set_Tasks(tasks);
            interactors.Refresh(tasks => sync.Process(tasks));

            // Create Task
            boardUi.Create_Task += text => {
                var task = interactors.Create_Task(text);
                boardUi.Add_Task(task);
            };

            // Show Task
            boardUi.Show_Task += (column, position) => {
                var text = interactors.Show_Task(column, position);
                boardUi.Display_Text(text);
            };

            // Move Task
            boardUi.Move_Task += (column, position, direction) => {
                var tasks_and_selectedTask = interactors.Move_Task(column, position, direction);
                boardUi.Set_Tasks(tasks_and_selectedTask.Item1, tasks_and_selectedTask.Item2);
            };

            var app = new Application { MainWindow = boardUi };
            app.Run(boardUi);
        }
开发者ID:slieser,项目名称:sandbox,代码行数:34,代码来源:Program.cs


示例9: ConvertToWriteableBitmap

        public ConvertToWriteableBitmap()
        {
            WriteableBitmap wb = null;

            // OpenCVによる画像処理 (Threshold)
            using (IplImage src = new IplImage(Const.ImageLenna, LoadMode.GrayScale))
            using (IplImage dst = new IplImage(src.Size, BitDepth.U8, 1))
            {
                src.Smooth(src, SmoothType.Gaussian, 5);
                src.Threshold(dst, 0, 255, ThresholdType.Otsu);
                // IplImage -> WriteableBitmap
                wb = dst.ToWriteableBitmap(PixelFormats.BlackWhite);
                //wb = WriteableBitmapConverter.ToWriteableBitmap(dst, PixelFormats.BlackWhite);
            }

            // WPFのWindowに表示してみる
            Image image = new Image { Source = wb };
            Window window = new Window
            {
                Title = "from IplImage to WriteableBitmap",
                Width = wb.PixelWidth,
                Height = wb.PixelHeight,
                Content = image
            };

            Application app = new Application();
            app.Run(window);
        }
开发者ID:qxp1011,项目名称:opencvsharp,代码行数:28,代码来源:ConvertToWriteableBitmap.cs


示例10: EnsureApplicationResources

        static void EnsureApplicationResources()
        {
            if (!UriParser.IsKnownScheme("pack"))
            {
                UriParser.Register(new GenericUriParser(GenericUriParserOptions.GenericAuthority), "pack", -1);
            }

            var appResourcesUri = new Uri("pack://application:,,,/GitHub.Authentication;component/AppResources.xaml", UriKind.RelativeOrAbsolute);

            // If we launch two dialogs in the same process (Credential followed by 2fa), calling new App()
            // throws an exception stating the Application class  can't be created twice. Creating an App
            // instance happens to set Application.Current to that instance (it's weird). However, if you
            // don't set the ShutdownMode to OnExplicitShutdown, the second time you launch a dialog,
            // Application.Current is null even in the same process.
            if (Application.Current == null)
            {
                var app = new Application();
                Debug.Assert(Application.Current == app, "Current application not set");
                app.ShutdownMode = ShutdownMode.OnExplicitShutdown;
                app.Resources.MergedDictionaries.Add(new ResourceDictionary { Source = appResourcesUri });
            }
            else
            {
                // Application.Current exists, but what if in the future, some other code created
                // the singleton. Let's make sure our resources are still loaded.
                var resourcesExist = Application.Current.Resources.MergedDictionaries.Any(r => r.Source == appResourcesUri);
                if (!resourcesExist)
                {
                    Application.Current.Resources.MergedDictionaries.Add(new ResourceDictionary { Source = appResourcesUri });
                }
            }
        }
开发者ID:colhountech,项目名称:Git-Credential-Manager-for-Windows,代码行数:32,代码来源:AuthenticationPrompts.cs


示例11: Main

 static void Main(string[] args)
 {
     Application app = new Application();
     MainWindow win = new MainWindow();
     //TestWnd win = new TestWnd();
     app.Run(win);
 }
开发者ID:zeuscn,项目名称:ShieldTunnelHealthEvaluation,代码行数:7,代码来源:App.xaml.cs


示例12: RemoteControlHandler

 /// <summary>
 /// Initializes a new instance of the <see cref="RemoteControlHandler"/> class.
 /// </summary>
 /// <param name="app">The app.</param>
 public RemoteControlHandler(Application app)
 {
     app.MainWindow.KeyDown += this.Window_KeyDown;
     app.MainWindow.CommandBindings.Add(new CommandBinding(MediaCommands.Play, this.MediaCommands_Play));
     app.MainWindow.CommandBindings.Add(new CommandBinding(MediaCommands.Stop, this.MediaCommands_Stop));
     app.MainWindow.CommandBindings.Add(new CommandBinding(MediaCommands.Record, this.MediaCommands_Record));
 }
开发者ID:bradsjm,项目名称:LaJustPowerMeter,代码行数:11,代码来源:RemoteControlHandler.cs


示例13: Convert

        public void Convert(string projectfile, string outputpath)
        {
            var app = new Application();
            var project = ProjectSettings.Load(projectfile);

            var jsf = Path.Combine(outputpath, "converter.settings.js");
            project.Save(jsf);

            var model = new ConverterModel();
            model.PageTitle = project.PageTitle;
            model.IsOptimized = false;
            model.InlineAllScript = true;
            model.OutputDirectory = outputpath;
            // model.IncludeResources = new string[] { "base.css", "application.css", "*.png", "octicons.*" };
            model.TraceOutputFile = "converter.output.html";

            // trace flags
            if (null != Flags)
            {
                Log.ShowVerbose = Flags.Verbose;
                Log.ShowConverterModel = Flags.ShowFiles;
                Log.ShowResources = Flags.ShowResources;

                if (Flags.ShowClasses)
                {
                    Log.ShowClassDependencies = Flags.ShowClasses;
                }
            }

            // setting the project property triggers the conversion process
            model.Project = project;

            WarningCount = model.Converter.WarningCount;
            ErrorCount = model.Converter.ErrorCount;
        }
开发者ID:thomas13335,项目名称:wpf2html5,代码行数:35,代码来源:ConverterWrapper.cs


示例14: Run

        protected override void Run()
        {
            RxApp.LoggerFactory = _ => new FileLogger("Squirrel") { Level = ReactiveUIMicro.LogLevel.Info };
            ReactiveUIMicro.RxApp.ConfigureFileLogging(); // HACK: we can do better than this later

            theApp = new Application();

            // NB: These are mirrored instead of just exposing Command because
            // Command is impossible to mock, since there is no way to set any
            // of its properties
            DisplayMode = Command.Display;
            Action = Command.Action;

            this.Log().Info("WiX events: DisplayMode: {0}, Action: {1}", Command.Display, Command.Action);

            setupWiXEventHooks();

            var bootstrapper = new WixUiBootstrapper(this);

            theApp.MainWindow = new RootWindow
            {
                viewHost = { Router = bootstrapper.Router }
            };

            MainWindowHwnd = IntPtr.Zero;
            if (Command.Display == Display.Full)
            {
                MainWindowHwnd = new WindowInteropHelper(theApp.MainWindow).Handle;
                uiDispatcher = theApp.MainWindow.Dispatcher;
                theApp.Run(theApp.MainWindow);
            }

            Engine.Quit(0);
        }
开发者ID:rzhw,项目名称:Squirrel.Windows,代码行数:34,代码来源:App.cs


示例15: StartRuntime

        /// <summary>
        /// Called by the bootstrapper's constructor at runtime to start the framework.
        /// </summary>
        protected virtual void StartRuntime() {
            Execute.InitializeWithDispatcher();
            EventAggregator.DefaultPublicationThreadMarshaller = Execute.OnUIThread;

            EventAggregator.HandlerResultProcessing = (target, result) => {
                var coroutine = result as IEnumerable<IResult>;
                if (coroutine != null) {
                    var viewAware = target as IViewAware;
                    var view = viewAware != null ? viewAware.GetView() : null;
                    var context = new ActionExecutionContext { Target = target, View = (DependencyObject)view };

                    Coroutine.BeginExecute(coroutine.GetEnumerator(), context);
                }
            };

            AssemblySource.Instance.AddRange(SelectAssemblies());

            if (useApplication) {
                Application = Application.Current;
                PrepareApplication();
            }

            Configure();
            IoC.GetInstance = GetInstance;
            IoC.GetAllInstances = GetAllInstances;
            IoC.BuildUp = BuildUp;
        }
开发者ID:LoungeFlyZ,项目名称:Caliburn-Micro-WinRT-Callisto-Helpers,代码行数:30,代码来源:Bootstrapper.cs


示例16: Main

        public static void Main(string[] args)
        {
            var app = new Application();
            Window wind = new PackageBuilderMainWindow();

            app.Run(wind);
        }
开发者ID:jira-sarec,项目名称:ICSE-2012-TraceLab,代码行数:7,代码来源:Program.cs


示例17: InformeGeneralObras

        public void InformeGeneralObras()
        {
            oExcel = new Application();
            oBooks = oExcel.Workbooks;
            oBook = oBooks.Add(1);
            oSheets = (Sheets)oBook.Worksheets;
            oSheet = oSheets.get_Item(1);

            this.oSheet.Cells[1,1] = "Consecutivo";
            this.oSheet.Cells[1,2] = "Título";
            this.oSheet.Cells[1,3] = "Núm. de Material";
            this.oSheet.Cells[1,4] = "Año";
            this.oSheet.Cells[1,5] = "Tiraje";            

            int ind = 2;
            for (int j = 0; j < obrasImprimir.Count; j++)
            {
                oSheet.Cells[1][ind] = obrasImprimir[j].Consecutivo;
                oSheet.Cells[2][ind] = obrasImprimir[j].Titulo;
                oSheet.Cells[3][ind] = obrasImprimir[j].NumMaterial;
                oSheet.Cells[4][ind] = obrasImprimir[j].AnioPublicacion;
                oSheet.Cells[5][ind] = obrasImprimir[j].Tiraje;
                ind++;
            }            
            this.oExcel.ActiveWorkbook.Save();
            this.oExcel.Quit();
        }
开发者ID:PeterRV,项目名称:Padron,代码行数:27,代码来源:ExcelReports.cs


示例18: Run

        public void Run() {
            FlowRuntimeConfiguration.SynchronizationFactory = () => new SyncWithWPFDispatcher();
            var frc = new FlowRuntimeConfiguration();
            frc.AddStreamsFrom("appchatten.application.root.flow", Assembly.GetExecutingAssembly());

            var chat = new Chat(new QueueFinder<Message>());
            var mainWindow = new MainWindow();

            frc.AddAction<string>("anmelden", chat.Anmelden);
            frc.AddAction<string>("verbinden", chat.Verbinden);
            frc.AddFunc<string, Message>("absender_hinzufuegen", chat.Absender_hinzufuegen);
            frc.AddFunc<Message, Message>("versenden", chat.Versenden).MakeAsync();
            frc.AddFunc<Message, string>("formatieren", m => string.Format("{0}: {1}", m.Absender, m.Text));
            frc.AddAction<string>("anzeigen", mainWindow.MessageHinzufügen).MakeSync();
            frc.AddOperation(new Timer("timer", 500));
            frc.AddAction<Message>("empfangen", chat.Empfangen).MakeAsync();
            frc.AddAction<FlowRuntimeException>("fehler_anzeigen", ex => mainWindow.FehlerAnzeigen(ex.InnerException.Message)).MakeSync();

            using (var fr = new FlowRuntime(frc)) {
                fr.Message += Console.WriteLine;

                fr.UnhandledException += fr.CreateEventProcessor<FlowRuntimeException>(".exception");

                mainWindow.Anmelden += fr.CreateEventProcessor<string>(".anmelden");
                mainWindow.Verbinden += fr.CreateEventProcessor<string>(".verbinden");
                mainWindow.TextSenden += fr.CreateEventProcessor<string>(".senden");

                var app = new Application{MainWindow = mainWindow};
                app.Run(mainWindow);
            }
        }     
开发者ID:slieser,项目名称:sandbox,代码行数:31,代码来源:AppChatten.cs


示例19: Main

        static void Main(string[] args)
        {
            if (args.Length != 0)
                if (args[0] == "testsC++")
                {
                    if (FonctionsNatives.executerTests())
                        Debug.Write("Échec d'un ou plusieurs tests.");
                    else
                        Debug.Write("Tests réussis.");

                    return;
                }

            chrono.Start();

            // Tiré de http://stackoverflow.com/questions/15811215/convert-number-in-textbox-to-float-c-sharp
            System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");

            Application app = new Application();
            var timer = new DispatcherTimer (
                TimeSpan.FromMilliseconds(1),
                DispatcherPriority.ApplicationIdle,
                (s, e) => ExecuterQuandInactif(s, e),
                app.Dispatcher
            );
            window = new MainWindow();

            app.Run(window);
        }
开发者ID:ArchSirius,项目名称:inf2990,代码行数:29,代码来源:Program.cs


示例20: Main

		static void Main()
		{
			//the WPF application object will be the main UI loop
			System.Windows.Application wpfApplication = new System.Windows.Application
			{
				//otherwise the application will close when all WPF windows are closed
				ShutdownMode = ShutdownMode.OnExplicitShutdown 
			};
			SynchronizationContext.SetSynchronizationContext(new DispatcherSynchronizationContext());

			//set the WinForms properties
			//notice how you don't need to do anything else with the Windows Forms Application (except handle exceptions)
			System.Windows.Forms.Application.EnableVisualStyles();
			System.Windows.Forms.Application.SetCompatibleTextRenderingDefault(false);
			
			WpfProgramAddWinForms p = new WpfProgramAddWinForms();
			p.ExitRequested += (sender, e) =>
			{
				wpfApplication.Shutdown();
			};

			Task programStart = p.StartAsync();
			HandleExceptions(programStart, wpfApplication);

			wpfApplication.Run();
		}
开发者ID:ittray,项目名称:LocalDemo,代码行数:26,代码来源:WpfProgramAddWinForms.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Windows.ApplicationUnhandledExceptionEventArgs类代码示例发布时间:2022-05-26
下一篇:
C# TestUtils.StringTextBuffer类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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