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


C# Application.Run方法代码示例

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


在下文中一共展示了Application.Run方法的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

        static void Main(string[] args)
        {
            i = new Image();
            RenderOptions.SetBitmapScalingMode(i, BitmapScalingMode.NearestNeighbor);
            RenderOptions.SetEdgeMode(i, EdgeMode.Aliased);

            w = new Window();
            w.Content = i;
            w.Show();

            writeableBitmap = new WriteableBitmap(
                (int)w.ActualWidth,
                (int)w.ActualHeight,
                96,
                96,
                PixelFormats.Bgr32,
                null);

            i.Source = writeableBitmap;

            i.Stretch = Stretch.None;
            i.HorizontalAlignment = HorizontalAlignment.Left;
            i.VerticalAlignment = VerticalAlignment.Top;

            i.MouseMove += new MouseEventHandler(i_MouseMove);
            i.MouseLeftButtonDown +=
                new MouseButtonEventHandler(i_MouseLeftButtonDown);
            i.MouseRightButtonDown +=
                new MouseButtonEventHandler(i_MouseRightButtonDown);

            w.MouseWheel += new MouseWheelEventHandler(w_MouseWheel);

            Application app = new Application();
            app.Run();
        }
开发者ID:KinectProject-ITKMITL,项目名称:Kinect,代码行数:35,代码来源:Form1.Designer.cs

示例4: 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

示例5: Main

        public static void Main()
        {
            App = new Application();
            App.Startup += (o, e) =>
            {
                //EU AWS
                DAOFactory.ConnectionString =
                    "SERVER=ec2-79-125-81-60.eu-west-1.compute.amazonaws.com;" +
                    "DATABASE=px3;" +
                    "UID=px3;" +
                    "PASSWORD=abcd1234;";

                //LOCAL
                /*DAOFactory.ConnectionString =
                "SERVER=localhost;" +
                "DATABASE=px3;" +
                "UID=root;" +
                "PASSWORD=abcd1234;";*/

                RunApp(CurrentUser);
            };
            try
            {
                App.Run();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + " Unfortunately the application couldn't be recovered, and is therefore restarting.");
                System.Diagnostics.Process.Start(Application.ResourceAssembly.Location);
                Application.Current.Shutdown();
            }
        }
开发者ID:hyllekilde,项目名称:PX3-BDSA-E2011,代码行数:32,代码来源:VoterListApp.cs

示例6: 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

示例7: 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

示例8: 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

示例9: Main

 static void Main()
 {
     var app = new Application();
     var window = new RegexEditor();
     app.MainWindow = window;
     app.Run(window);
 }
开发者ID:bungeemonkee,项目名称:VSPlugins,代码行数:7,代码来源:Program.cs

示例10: 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

示例11: ConvertToWriteableBitmap

        public ConvertToWriteableBitmap()
        {
            WriteableBitmap wb = null;

            // OpenCV processing
            using (var src = new IplImage(FilePath.Image.Lenna, LoadMode.GrayScale))
            using (var 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);
            }

            // Shows WriteableBitmap to WPF window
            var image = new Image { Source = wb };
            var window = new Window
            {
                Title = "from IplImage to WriteableBitmap",
                Width = wb.PixelWidth,
                Height = wb.PixelHeight,
                Content = image
            };

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

示例12: Run

        public void Run() {
            var mainWindowViewModel = new MainWindowViewModel();
            var mainWindow = new MainWindow();
            mainWindow.DataContext = mainWindowViewModel;
            var app = new Application {
                MainWindow = mainWindow
            };

            var mapper = new Mapper(mainWindowViewModel);

            FlowRuntimeConfiguration.DispatcherFactory = () => new DispatchForWPF();

            var flowRuntimeConfguration = new FlowRuntimeConfiguration()
                .AddStreamsFrom("fotobrowser.root.flow", Assembly.GetExecutingAssembly())
                .AddFunc("arbeitsverzeichnis_ermitteln", () => Environment.GetCommandLineArgs()[1])
                .AddFunc<string, IEnumerable<contracts.Directory>>("unterverzeichnisse_ermitteln", Drives.Verzeichnisse_ermitteln)
                .AddAction<IEnumerable<contracts.Directory>>("verzeichnisse_mappen", mapper.MapDirectories).MakeDispatched()
                .AddFunc<string, IEnumerable<string>>("bilddateien_ermitteln", Drives.Bilddateien_ermitteln)
                .AddAction<IEnumerable<string>>("bilddateien_mappen", mapper.MapFilenames).MakeDispatched();

            using (var flowRuntime = new FlowRuntime(flowRuntimeConfguration)) {
                flowRuntime.Message += Console.WriteLine;
                flowRuntime.UnhandledException += Console.WriteLine;

                mainWindow.Refresh += flowRuntime.CreateEventProcessor<string>(".refresh");

                flowRuntime.Process(".start");
                app.Run(mainWindow);
            }
        }
开发者ID:slieser,项目名称:sandbox,代码行数:30,代码来源:Fotobrowser.cs

示例13: EnsureFileUpdateWindow

        private void EnsureFileUpdateWindow()
        {
            lock (_Lock)
            {
                if (_FileUpdateWindow == null)
                {
                    AutoResetEvent wait = new AutoResetEvent(false);

                    ThreadStart threadStart =
                        delegate
                        {
                            _FileUpdateWindow = new FileUpdateWindow();
                            _FileUpdateWindow.DeploymentManifest = DeploymentManifest;
                            _FileUpdateWindow.TotalUpdateSize = TotalUpdateSize;
                            wait.Set();

                            _FileUpdateWindow.Show();
                            _FileUpdateWindow.SlideUp();

                            Application app = new Application();
                            app.Run(_FileUpdateWindow);
                        };
                    Thread thread = new Thread(threadStart);
                    thread.SetApartmentState(ApartmentState.STA);
                    thread.Start();

                    wait.WaitOne();
                }
            }
        }
开发者ID:samuraitruong,项目名称:comitdownloader,代码行数:30,代码来源:WPFUpdateNotifier.cs

示例14: Main

        static void Main()
        {
            AppDomain.CurrentDomain.UnhandledException += (args, e) => Log.Debug(e.ExceptionObject.ToString());

            Settings.KeyBindings.Initialize();

            var window = new EditorWindow();
            var context = new GxContext(window.DrawTarget);
            context.InitContext();

            InterfaceManager.Instance.Initialize(window.DrawTarget, context);
            WorldFrame.Instance.Initialize(window.DrawTarget, context);
            WorldFrame.Instance.OnResize((int) window.RenderSize.Width, (int) window.RenderSize.Height);

            InterfaceManager.Instance.RenderWindow.OnLoadFinished();

            var app = new Application();
            var timer = new DispatcherTimer(TimeSpan.FromMilliseconds(10), DispatcherPriority.ApplicationIdle,
                (sender, args) =>
                {
                    context.BeginFrame();
                    WorldFrame.Instance.OnFrame();
                    InterfaceManager.Instance.OnFrame();
                    context.EndFrame();
                }, app.Dispatcher);

            app.Run(window);

            WorldFrame.Instance.Shutdown();
        }
开发者ID:Linrasis,项目名称:WoWEditor,代码行数:30,代码来源:Program.cs

示例15: OnStart

    override protected void OnStart()
    {
      appViewModel = new PeerCastAppViewModel(Application);
      versionChecker = new PeerCastStation.UI.Updater();
      notifyIconThread = new Thread(() => {
        notifyIconManager = new NotifyIconManager(appViewModel, this);
        versionChecker.NewVersionFound += (sender, e) => {
          notifyIconManager.NotifyNewVersions(e.VersionDescriptions);
        };
        notifyIconManager.Run();
      });
      notifyIconThread.SetApartmentState(ApartmentState.STA);
      notifyIconThread.Start();
      versionCheckTimer = new Timer(OnVersionCheckTimer, null, 1000, 1000*7200);

      mainThread = new Thread(() => {
        var app = new Application();
        var settings = Application.Settings.Get<WPFSettings>();
        mainWindow = new MainWindow(appViewModel);
        if (settings.ShowWindowOnStartup) mainWindow.Show();
        app.Run();
      });
      mainThread.Name = "WPF UI Thread";
      mainThread.SetApartmentState(ApartmentState.STA);
      mainThread.Start();
    }
开发者ID:kumaryu,项目名称:peercaststation,代码行数:26,代码来源:UserInterface.cs


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