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


C# Windows.Application类代码示例

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


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


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