本文整理汇总了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 ();
}
示例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);
} }
示例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();
}
示例4: Main
static void Main(string[] args)
{
Application app = new Application();
MainWindow win = new MainWindow();
//TestWnd win = new TestWnd();
app.Run(win);
}
示例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();
}
}
示例6: Main
public static void Main(string[] args)
{
var app = new Application();
Window wind = new PackageBuilderMainWindow();
app.Run(wind);
}
示例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);
}
示例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);
}
示例9: Main
static void Main()
{
var app = new Application();
var window = new RegexEditor();
app.MainWindow = window;
app.Run(window);
}
示例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);
}
示例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);
}
示例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);
}
}
示例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();
}
}
}
示例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();
}
示例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();
}