public static void RunInForms() { GMUF gmu = new GMUF(height + 2, width + 2); MultiSplitScreenManager mssm = new MultiSplitScreenManager(gmu.PlacePixels, width, height); FullScreenManager screen = new FullScreenManager(width - 2, height - 2, null); mssm.AddScreen(screen, new System.Drawing.Rectangle(1, 1, width - 2, height - 2)); gmu.PrintFrame(); Camera c = GetCamera(GetGeometry()); NotAConsoleWindow w = new NotAConsoleWindow(); w.IdleHandle = () => OnIdleHandle(c, screen, gmu); Thread t = new Thread(() => { Application.EnableVisualStyles(); Application.Run(w); }); (gmu).SetRederingForm(w); t.SetApartmentState(ApartmentState.STA); t.Start(); Console.WriteLine("Running In forms"); t.Join(); }
//TODO Search Query Help //TODO Tags Parsing //TODO Search and Favorites Selection //TODO Search and Favorites Paging //TODO Search and Paging Saving (Separate and auromate) public MainWindowConnector(IListManager listManager, IEventSystem eventSystem, IAppStates appStatem, OperationManager manager, FilesManager filesManager, ImageManager imageManager) : base(listManager, eventSystem) { _appStatem = appStatem; ReactOn <PrepareLoadEvent>(_ => FileListIndex = 0); ReactOn <PostLoadingEvent>(e => _appStatem.Set <GlobalAppState>(s => s.LastLocation = e.Path)); DisposeThis(filesManager.FilterObservable.Subscribe(_ => FileListIndex = 1)); OperationManager = manager; FilesManager = filesManager; ImageManager = imageManager; WindowState = new UIWindowState(_appStatem); _fullScreenManager = new FullScreenManager(WindowState); OpenLocationCommand = BindToEvent(OpenLocation); NextImage = BindToEvent(_ => new NextPageEvnt(false)); BackImage = BindToEvent(_ => new NextPageEvnt(true)); DeleteCommand = BindToEvent( _ => MessageBox.Show("Wírklich Löschen?", "Löschen", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes ? new DeleteEvent(ImageManager.CurrentIndex) : null); ToogleFavoriteCommand = BindToEvent(_ => new ToogleFavoritesEvent(ImageManager.CurrentIndex)); FullScreen = new DelegateCommand(_ => _fullScreenManager.EnableFullScreen(), _ => true); }
public MainWindow() { InitializeComponent(); WindowsZOrderManager.SetManagerOwner(this); var full = new FullScreenManager(this); WindowsZOrderManager.AddPopup(TestPopup); }
static void Main(string[] args) { //Image img = Image.FromFile("test.file"); Console.BackgroundColor = ConsoleColor.Black; Console.ForegroundColor = ConsoleColor.White; Console.Clear(); GMU gmu = new GMU(100, 40, 0, 0); MultiSplitScreenManager msc = new MultiSplitScreenManager(gmu.PlacePixels, 40, 100); FullScreenManager full = new FullScreenManager(40, 100, null); msc.AddScreen(full, new Rectangle(0, 0, 40, 100)); FullScreenManager fs1 = new FullScreenManager(50, 40, null); FullScreenManager fs2 = new FullScreenManager(50, 40, null); full.App_DrawScreen(BasicProvider.getInked(4, 100, new PInfo().SetBg(ConsoleColor.Black).SetFg(ConsoleColor.White)), 0, 0, null); gmu.PrintFrame(); full.App_DrawScreen(BasicProvider.TextToPInfo("Test", 20, 20, new PInfo().SetFg(ConsoleColor.White)), 3, 3, null); gmu.PrintFrame(); Console.ForegroundColor = ConsoleColor.White; Console.WriteLine(Console.WindowWidth); Console.WriteLine(Console.WindowHeight); Console.WriteLine(Console.LargestWindowWidth); Console.WriteLine(Console.LargestWindowHeight); msc.AddScreen(fs1, new Rectangle(0, 0, 50, 40)); msc.AddScreen(fs2, new Rectangle(50, 0, 50, 40)); Console.ReadKey(); gmu.PlacePixels(simpleSquare, 20, 8, null); fs1.App_DrawScreen(BasicProvider.getInked(48, 38, new PInfo(' ', ConsoleColor.White, ConsoleColor.Red)), 1, 1, null); fs2.App_DrawScreen(BasicProvider.getInked(48, 38, new PInfo(' ', ConsoleColor.White, ConsoleColor.Blue)), 1, 1, null); fs1.App_DrawScreen(simpleSquare, 1, 1, null); fs2.App_DrawScreen(BasicProvider.TextToPInfo("I try this new thing with text", 10, 10, new PInfo().SetFg(ConsoleColor.Black)), 3, 5, null); fs2.App_DrawScreen(BasicProvider.TextToPInfo("I try this new thing with text", 10, 10, new PInfo().SetFg(ConsoleColor.Red)), 3, 2, null); gmu.PrintFrame(); Console.ReadLine(); }
public WindowBase() { InitializeStyle(); FullScreenManager.RepairWpfWindowFullScreenBehavior(this); this.SourceInitialized += delegate(object sender, EventArgs e) { this._HwndSource = PresentationSource.FromVisual((Visual)sender) as HwndSource; }; this.Loaded += delegate { InitializeEvent(); }; }
public WaitingForm() { InitializeComponent(); this.Background = CommonUtil.From16JinZhi("#4F000000"); // 这句话是防止弹出窗口挡住桌面的工具栏 FullScreenManager.RepairWpfWindowFullScreenBehavior(this); try { this.Owner = Application.Current.MainWindow; } catch { } }
static void Main(string[] args) { GMU gmu = new GMU(width + 5, height + 5, 1, 1); MultiSplitScreenManager mssm = new MultiSplitScreenManager(gmu.PlacePixels, width, height); FullScreenManager screen = new FullScreenManager(width - 2, height - 2, null); mssm.AddScreen(screen, new System.Drawing.Rectangle(1, 1, width - 2, height - 2)); //screen.App_DrawScreen(BasicProvider.TextToPInfo("Hello World!", 7, 3, new PInfo().SetBg(ConsoleColor.Gray).SetFg(ConsoleColor.Green)),5,5,screen); // Camera and objects List <Geometry> geometries = new List <Geometry>(); geometries.Add(new Geometry(new Vector3(1, 1, 5), ConsoleColor.Red)); geometries.Add(new Geometry(new Vector3(3, 0, 2), ConsoleColor.Yellow)); geometries.Add(new Geometry(new Vector3(-2, 1, 4), ConsoleColor.Green)); Camera c = new Camera(new Vector3(0, 2, 0), new Vector3(0, 0, 1), height - 2, width - 2, 110, geometries); PInfo[,] image = c.RenderImage(); screen.App_DrawScreen(image, 0, 0, null); gmu.PrintFrame(); //Console.ReadLine(); Debug.WriteLine("first frame"); System.Threading.Thread.Sleep(5000); c.ViewDirection = new Vector3(1, 0, 1); Debug.WriteLine("Direction Change"); System.Threading.Thread.Sleep(2000); PInfo[,] data = c.RenderImage(); Debug.WriteLine("render"); System.Threading.Thread.Sleep(2000); screen.App_DrawScreen(data, 0, 0, screen); Debug.WriteLine("Screen"); System.Threading.Thread.Sleep(2000); gmu.PrintFrame(); Debug.WriteLine("PrintFrame"); Console.ReadLine(); }
public MainWindow(IDsEnvironment dsEnvironment, IDsConfigurationSection dsconfig) { InitializeComponent(); dsNotifications.Top = SystemParameters.WorkArea.Height - topOffset; dsNotifications.Left = SystemParameters.WorkArea.Left + SystemParameters.WorkArea.Width - leftOffset; DsEnvironment = dsEnvironment; /////这里是在初始化加载控件之前就已经做了,故使用配置的方式进行加载 ////1、创建默认主题(默认情况下是DeepBlue) if (dsconfig.Themes.Count > 0) { foreach (ThemeElement item in dsconfig.Themes) { ThemeManage.CurrentTheme = item.Name; break; } } System.Windows.Application.Current.Resources.MergedDictionaries.Clear(); ////2、加载控件的样式 foreach (ModuleConfigurationElement module in dsconfig.Modules) { string assemblyfile = module.AssemblyFile.Substring(module.AssemblyFile.LastIndexOf('/') + 1); string path = assemblyfile.Substring(0, assemblyfile.LastIndexOf('.')); ThemeManage.EnsureApplicationResources(ThemeManage.CurrentTheme, path); } //////这部分代码怎么实现的问题---gefx //if (dsEnvironment.AddinInfos == null || dsEnvironment.AddinInfos.Count <= 0) // DsEnvironment = ParentContaioner.GetObject<IDsEnvironment>(); //foreach (AddinInfo addininfo in DsEnvironment.AddinInfos.Values) //{ // ////这里又有一个问题就是命名空间要更程序集的名称对应,不然的话就需要截取字符串的形式啦!! // string assemblyname = addininfo.AddinNameSpace; // ThemeManage.EnsureApplicationResources(ThemeManage.CurrentTheme, assemblyname); //} #region Debug //base.SetWindowTheme("DeepBlue", "DS.AFP.UIFramework"); #endregion App.iconMouseEvent += App_iconMouseEvent; FullScreenManager.RepairWpfWindowFullScreenBehavior(this); }
public static void StartGMU() { FastGMU gmu = new FastGMU(width, height); MultiSplitScreenManager sm = new MultiSplitScreenManager(gmu.PlacePixels, height, width); // use this for rendering FullScreenManager rs = new FullScreenManager(width - 2, height - 2, null); DoomScreenManager doom = new DoomScreenManager(null, width - 2, height - 2); sm.AddScreen(doom, new System.Drawing.Rectangle(1, 1, width - 2, height - 2)); doom.Render(); gmu.PrintFrame(); bool stop = false; bool sneak = false; doom.PlayerHeight = 1; Stopwatch watch = new Stopwatch(); while (!stop) { watch.Start(); time += 0.1; double currRotation = Math.Atan2(doom.Player.y_2 - doom.Player.y_1, doom.Player.x_2 - doom.Player.x_1); if (Keyboard.IsKeyDown(Key.C)) { if (sneak) { doom.PlayerHeight = 1; sneak = false; } else { doom.PlayerHeight = 0.5; sneak = true; } } if (Keyboard.IsKeyDown(Key.A)) { MoveLeft(doom); } if (Keyboard.IsKeyDown(Key.S)) { MoveBack(doom); } if (Keyboard.IsKeyDown(Key.D)) { MoveRight(doom); } if (Keyboard.IsKeyDown(Key.W)) { MoveFront(doom); } if (Keyboard.IsKeyDown(Key.Right)) { doom.Player.x_2 = doom.Player.x_1 + Math.Cos(currRotation + rotation); doom.Player.y_2 = doom.Player.y_1 + Math.Sin(currRotation + rotation); } if (Keyboard.IsKeyDown(Key.Left)) { doom.Player.x_2 = doom.Player.x_1 + Math.Cos(currRotation - rotation); doom.Player.y_2 = doom.Player.y_1 + Math.Sin(currRotation - rotation); } doom.PlayerHeight = (sneak ? 1 : 0.5) + Math.Sin(time) * 0.1; //Console.Clear(); doom.Render(); watch.Stop(); gmu.PlacePixels( BasicProvider.TextToPInfo((1d / ((double)watch.ElapsedMilliseconds / 1000)).ToString("#.000") + " FPS", 10, 1, new PInfo().SetBg(ConsoleColor.Black).SetFg(ConsoleColor.White)), 0, 0, null); watch.Restart(); gmu.PrintFrame(); System.Threading.Thread.Sleep(1); } //Console.ReadKey(true); }
public static void StartGMUF() { GMUF gmu = new GMUF(height, width); NotAConsoleWindow w = new NotAConsoleWindow(); Task t = new Task(() => { Application.EnableVisualStyles(); Application.Run(w); }); (gmu as GMUF).SetRederingForm(w); t.Start(); MultiSplitScreenManager sm = new MultiSplitScreenManager(gmu.PlacePixels, height, width); // use this for rendering FullScreenManager rs = new FullScreenManager(width - 2, height - 2, null); DoomScreenManager doom = new DoomScreenManager(null, width - 2, height - 2); sm.AddScreen(doom, new System.Drawing.Rectangle(1, 1, width - 2, height - 2)); doom.Render(); gmu.PrintFrame(); ConsoleKey input; bool sneak = false; while ((input = Console.ReadKey(true).Key) != ConsoleKey.Spacebar) { double currRotation = Math.Atan2(doom.Player.y_2 - doom.Player.y_1, doom.Player.x_2 - doom.Player.x_1); switch (input) { case ConsoleKey.C: if (sneak) { doom.PlayerHeight = 1; sneak = false; } else { doom.PlayerHeight = 0.5; sneak = true; } break; case ConsoleKey.A: MoveLeft(doom); break; case ConsoleKey.S: MoveBack(doom); break; case ConsoleKey.D: MoveRight(doom); break; case ConsoleKey.W: MoveFront(doom); break; case ConsoleKey.RightArrow: doom.Player.x_2 = doom.Player.x_1 + Math.Cos(currRotation + rotation); doom.Player.y_2 = doom.Player.y_1 + Math.Sin(currRotation + rotation); break; case ConsoleKey.LeftArrow: doom.Player.x_2 = doom.Player.x_1 + Math.Cos(currRotation - rotation); doom.Player.y_2 = doom.Player.y_1 + Math.Sin(currRotation - rotation); break; default: break; } //Console.Clear(); doom.Render(); gmu.PrintFrame(); } //Console.ReadKey(true); }
public MainWindow() { InitializeComponent(); AppSet.AppMainWindow = this; //以下代码,修复窗体全屏时覆盖任务栏以及大小不正确问题。 FullScreenManager.RepairWpfWindowFullScreenBehavior(this); //设定升级检测定时器 _UpdateAppTimer = new System.Windows.Threading.DispatcherTimer(); _UpdateAppTimer.Tick += new EventHandler(async(x, y) => { await CheckAppUpdateAsync(); }); _UpdateAppTimer.Interval = new TimeSpan(0, 0, 0); //设定网络状态检测定时器 _CheckNetStateTimer = new System.Windows.Threading.DispatcherTimer(); _CheckNetStateTimer.Tick += new EventHandler(async(x, y) => { await CheckNetStateAsync(); }); _CheckNetStateTimer.Interval = new TimeSpan(0, 0, 10); #region 显示系统托盘图标 //系统托盘显示 this.notifyIcon = new NotifyIcon(); this.notifyIcon.BalloonTipText = "系统监控中... ..."; this.notifyIcon.ShowBalloonTip(2000); this.notifyIcon.Text = "政工业务工作平台"; //this.notifyIcon.Icon = new System.Drawing.Icon(@"AppIcon.ico"); this.notifyIcon.Icon = System.Drawing.Icon.ExtractAssociatedIcon(System.Windows.Forms.Application.ExecutablePath); this.notifyIcon.Visible = true; //托盘右键菜单项 this.notifyIcon.ContextMenuStrip = new ContextMenuStrip(); this.notifyIcon.ContextMenuStrip.Height = 300; this.notifyIcon.ContextMenuStrip.Items.Add("显示主窗口", null, (sender, eventArgs) => { if (WinLockDialog.ThisWinObj != null) { //说明该锁定窗口已经打开 WinLockDialog.ThisWinObj.Activate(); return; } if (AppSet.AppIsLocked) { WinLockDialog wld = new WinLockDialog(); if (!wld.ShowDialog().Value) { return; } } AppSet.AppIsLocked = false; this.Visibility = System.Windows.Visibility.Visible; this.ShowActivated = true; this.ShowInTaskbar = true; this.WindowState = WindowState.Maximized; this.Activate(); }); this.notifyIcon.ContextMenuStrip.Items.Add("关闭显示器", null, (sender, eventArgs) => { CloseScreen.Close(); }); this.notifyIcon.ContextMenuStrip.Items.Add("锁定软件", null, (sender, eventArgs) => { LockApp(); }); this.notifyIcon.ContextMenuStrip.Items.Add("关闭程序", null, (sender, eventArgs) => { ShutDownApp(); }); //托盘双击响应 this.notifyIcon.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler((o, e) => { if (e.Button == MouseButtons.Left) { this.notifyIcon.ContextMenuStrip.Items[0].PerformClick(); } }); #endregion }
public static void RunInConsole() { FastGMU gmu = new FastGMU(width + 2, height + 2); MultiSplitScreenManager mssm = new MultiSplitScreenManager(gmu.PlacePixels, width, height); FullScreenManager screen = new FullScreenManager(width - 2, height - 2, null); mssm.AddScreen(screen, new System.Drawing.Rectangle(1, 1, width - 2, height - 2)); gmu.PrintFrame(); Camera c = GetCamera(GetGeometry()); ConsoleKeyInfo input; double MoveDistance = 0.2; double rotateRad = Vector3.DegToRad(5); bool running = true; while (running) { //System.Threading.Thread.Sleep(20); if (Keyboard.IsKeyDown(Key.Escape)) { running = false; } if (Keyboard.IsKeyDown(Key.A)) { c.Position = c.Position + ((new Vector3(-c.ViewDirection.Z, 0, c.ViewDirection.X).AsNormalized()) * MoveDistance); } if (Keyboard.IsKeyDown(Key.S)) { c.Position = c.Position + ((new Vector3(c.ViewDirection.X, 0, c.ViewDirection.Z).AsNormalized()) * -MoveDistance); } if (Keyboard.IsKeyDown(Key.D)) { c.Position = c.Position + ((new Vector3(c.ViewDirection.Z, 0, -c.ViewDirection.X).AsNormalized()) * MoveDistance); } if (Keyboard.IsKeyDown(Key.W)) { c.Position = c.Position + ((new Vector3(c.ViewDirection.X, 0, c.ViewDirection.Z).AsNormalized()) * MoveDistance); } if (Keyboard.IsKeyDown(Key.Space)) { c.Position = c.Position + (new Vector3(0, 1, 0) * MoveDistance); } if (Keyboard.IsKeyDown(Key.C)) { c.Position = c.Position + (new Vector3(0, -1, 0) * MoveDistance); } if (Keyboard.IsKeyDown(Key.Left)) { c.ViewDirection = c.ViewDirection.RotateY(-rotateRad); } if (Keyboard.IsKeyDown(Key.Down)) { double currAngle = c.ViewDirection.Angle.Y; double target = currAngle + rotateRad; if (target < Math.PI) { // we can change the angle double realAngle = Math.Abs(target - (Math.PI / 2)); double realHeight = Math.Tan(realAngle); double corrected = realHeight * Math.Sqrt(c.ViewDirection.X * c.ViewDirection.X + c.ViewDirection.Z * c.ViewDirection.Z); c.ViewDirection.Y = corrected; if (target > Math.PI / 2) { // negative c.ViewDirection.Y = c.ViewDirection.Y * -1; } } } if (Keyboard.IsKeyDown(Key.Right)) { c.ViewDirection = c.ViewDirection.RotateY(rotateRad); } if (Keyboard.IsKeyDown(Key.Up)) { double currAngleI = c.ViewDirection.Angle.Y; double targetI = currAngleI - rotateRad; if (targetI < Math.PI) { // we can change the angle double realAngle = Math.Abs(targetI - (Math.PI / 2)); double realHeight = Math.Tan(realAngle); double corrected = realHeight * Math.Sqrt(c.ViewDirection.X * c.ViewDirection.X + c.ViewDirection.Z * c.ViewDirection.Z); c.ViewDirection.Y = corrected; if (targetI > Math.PI / 2) { // negative c.ViewDirection.Y = c.ViewDirection.Y * -1; } } } //Debug.WriteLine("before render"); screen.App_DrawScreen(c.RenderImage(), 0, 0, null); //Debug.WriteLine("After render"); gmu.PrintFrame(); } }
// here is how the distributes of rotation works #endregion static void Main(string[] args) { // setup the GMU Console.BackgroundColor = ConsoleColor.Black; Console.ForegroundColor = ConsoleColor.White; GMU gmu = new GMU(height + 10, width + 10); FullScreenManager screen = new FullScreenManager(height, width, gmu.PlacePixels); PlaceImage(screen, 0, 0, BasicProvider.getInked(width, height, new PInfo('A', ConsoleColor.Black, ConsoleColor.White))); gmu.PrintFrame(); // x , y garden = new GrasTile[width, height]; InitializeGarden(); mower = new Mower(10, 10, Math.PI * 115 / 180); ConsoleKeyInfo input; while ((!Console.KeyAvailable)) { foreach (var item in garden) { PlaceImage(screen, item.position.X, item.position.Y, BasicProvider.getInked(1, 1, item.getInfo())); } //gmu.PrintFrame(); Debug.WriteLine("angle: " + mower.angle * 180 / Math.PI + "°"); /*switch (input.Key.ToString()) * { * case "RightArrow": * //mower.angle = mower.angle + Math.PI / 16; * //mower.UpdateVectorFromAngle(); * break; * case "LeftArrow": * //mower.angle = mower.angle - Math.PI / 16; * //mower.UpdateVectorFromAngle(); * break; * case "A": * * break; * case "W": * * break; * case "D": * * break; * default: * break; * }*/ PlaceImage(screen, (int)mower.posX, (int)mower.posY, BasicProvider.getInked(1, 1, new PInfo('O', ConsoleColor.White, ConsoleColor.Gray))); gmu.PrintFrame(); Queue <GrasTile> cutTiles = CalculateMowerUntilNextStop(false); mower = new Mower(mower.posX, mower.posY, mower.angle); if (cutTiles.Count > 0) { //cutTiles.Dequeue(); } foreach (var item in cutTiles) { PInfo i = new PInfo(); i.background = ConsoleColor.DarkGray; PlaceImage(screen, item.position.X, item.position.Y, BasicProvider.getInked(1, 1, i)); } gmu.PrintFrame(); //System.Threading.Thread.Sleep(1500); /*if (Console.KeyAvailable) * { * Console.ReadKey(true); * }*/ CalculateMowerUntilNextStop(true); while (cutTiles.Count > 0) { GrasTile tile = cutTiles.Dequeue(); tile.Cut(); PlaceImage(screen, tile.position.X, tile.position.Y, BasicProvider.getInked(1, 1, tile.getInfo())); System.Threading.Thread.Sleep(waitTime); gmu.PrintFrame(); } RePlaceAllTiles(screen, gmu); } Console.ReadKey(true); }
public void SetInstance() { inst = this; }
public Window() { this.Style = (Style)Application.Current.Resources["VSWindowStyle"]; FullScreenManager.RepairWpfWindowFullScreenBehavior(this); this.Loaded += DefaultWindow_Loaded; }