static void perform(int action, Keys key) { if (!Working) { return; } if (ExcludedKeys.Contains(key)) { return; } var fore = Win32ApiWrapper.GetForegroundWindow(); if (!MainWindows.Any(w => w.SameOrBelongTo(fore))) { return; } WorkingNotice?.BeginInvoke(fore, null, null); for (var i = AllWindows.Count - 1; i >= 0; i--) { var item = AllWindows[i]; var w = item.Key; if (w.SameOrBelongTo(fore)) { continue; } var r = Win32ApiWrapper.PostMessage(w, action, (int)key, 0); if (r == 0) { AllWindows.Remove(item); WindowLost?.BeginInvoke(w, null, null); } } }
public WindowsForm2() { InitializeComponent(); List <MainWindows.MainWindowsDelegate> clients = new List <MainWindows.MainWindowsDelegate>(2); MainWindows.MainWindowsDelegate x = new MainWindows.MainWindowsDelegate(populateTextBox); MainWindows.MainWindowsDelegate xx = new MainWindows.MainWindowsDelegate(populateGridbox); clients.Add(x); clients.Add(xx); mw = new MainWindows(refreshMillis, clients, new RealWindowStuff()); }
public WindowsForm() { InitializeComponent(); MainWindows.MainWindowsDelegate x = new MainWindows.MainWindowsDelegate(populateWindowsGridListView); List <MainWindows.MainWindowsDelegate> lc = new List <MainWindows.MainWindowsDelegate>(1); lc.Add(x); RealWindowStuff ws = new RealWindowStuff(); mw = new MainWindows(refreshMillis, lc, ws); }
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { UIApplication uiapp = commandData.Application; UIDocument uidoc = uiapp.ActiveUIDocument; Document doc = uidoc.Document; BipCheckerViewmodel vm = new BipCheckerViewmodel(uidoc); MainWindows frMainWindows = new MainWindows(vm); frMainWindows.SetRevitAsWindowOwner(); frMainWindows.Show(); return(Result.Succeeded); }
public void MainWindowsTest() { QuasiLogger.log("MainWindowsTest()"); MainWindows.MainWindowsDelegate x = new MainWindows.MainWindowsDelegate(blah); List <MainWindows.MainWindowsDelegate> clients = new List <MainWindows.MainWindowsDelegate>(1); clients.Add(x); int i = 1000; List <FakeWindowStuff.FakedWindow> fws = new List <FakeWindowStuff.FakedWindow>(); fws.Add(new FakeWindowStuff.FakedWindow(new IntPtr(i++), "TestWindow_1", false)); //1000 fws.Add(new FakeWindowStuff.FakedWindow(new IntPtr(i++), "TestWindow_2", true)); fws.Add(new FakeWindowStuff.FakedWindow(new IntPtr(i++), "TestWindow_3", false)); fws.Add(new FakeWindowStuff.FakedWindow(new IntPtr(i++), "TestWindow_4", true)); fws.Add(new FakeWindowStuff.FakedWindow(new IntPtr(i++), "TestWindow_5", false)); fws.Add(new FakeWindowStuff.FakedWindow(new IntPtr(i++), "TestWindow_6", true)); fws.Add(new FakeWindowStuff.FakedWindow(new IntPtr(i++), "TestWindow_7", false)); fws.Add(new FakeWindowStuff.FakedWindow(new IntPtr(i++), "TestWindow_8", true)); //SetTimer for ending the test; QuasiLogger.log("SetTimer()"); aTimer = new System.Timers.Timer(_timeoutForTest); aTimer.Elapsed += OnTimedEvent; aTimer.AutoReset = true; aTimer.Enabled = true; //set windows first time _mw = new MainWindows(Convert.ToInt32(cycle), clients, new FakeWindowStuff(fws)); //a timer after n seconds which alters after a pause the window list ... = user did something. QuasiLogger.log("setting usertimer to: " + _timequasiUserTimer + " mytime: " + myTime()); quasiUserTimer = new System.Timers.Timer(_timequasiUserTimer); quasiUserTimer.Elapsed += OnquasiUserTimer; quasiUserTimer.AutoReset = true; quasiUserTimer.Enabled = true; //test leider beendet... while (!_finished && !_hasException) { } if (_hasException) { Assert.Fail("An exception occured."); } if (_calls != 4) { Assert.Fail("Not all tests done."); } }
/// <summary> /// Starts to sychronize keyboard events, will be failed if <see cref="MainWindows"/> is null or empty. /// </summary> public static void Start() { if (Working) { return; } Collect(); MainWindows = AllWindows.Where(w => w.Value).Select(w => w.Key); Working = MainWindows.Any(); if (!Working) { FailToStart?.BeginInvoke(null, null); return; } Started?.BeginInvoke(null, null); }
public int Run(string[] arguments) { var exename = Path.GetFileNameWithoutExtension (Assembly.GetEntryAssembly ().Location); if (Platform.IsLinux) { Application.Initialize (ToolkitType.Gtk3); } else if (Platform.IsWindows) { Application.Initialize (ToolkitType.Wpf); } else if (Platform.IsMac) Application.Initialize (ToolkitType.Cocoa); Runtime.SetProcessName (exename); MainWindows window = new MainWindows (); window.Show (); Application.Run (); window.Dispose (); Application.Dispose (); return 0; }
public LogInPresenter(ILogInWindow logInPage) { this.logInPage = logInPage; logInPage.LogIn += (sender, e) => { if (logInPage.FighterName.Length < 3 || logInPage.FighterName.Length > 20) { logInPage.Error = "Имя бойца должно содержать от 3 до 20 символов"; } else { MainWindows.Fighter1Window = new Fighter1Window(new Fighter(logInPage.FighterName)); MainWindows.Fighter2Window = new Fighter2Window(new ComputerAI("Тайлер Дёрден")); MainWindows.LogWindow = new LogWindow(); MainWindows.FightPresenter = new FightPresenter(MainWindows.FighterPresenter, MainWindows.ComputerPresenter, MainWindows.LogPresenter); MainWindows.StartFight(); } }; }
/// <summary> /// Executes in two distinct scenarios. /// /// 1. If disposing is true, the method has been called directly /// or indirectly by a user's code via the Dispose method. /// Both managed and unmanaged resources can be disposed. /// /// 2. If disposing is false, the method has been called by the /// runtime from inside the finalizer and you should not reference (access) /// other managed objects, as they already have been garbage collected. /// Only unmanaged resources can be disposed. /// </summary> /// <param name="disposing"></param> /// <remarks> /// If any exceptions are thrown, that is fine. /// If the method is being done in a finalizer, it will be ignored. /// If it is thrown by client code calling Dispose, /// it needs to be handled by fixing the bug. /// /// If subclasses override this method, they should call the base implementation. /// </remarks> protected override void Dispose(bool disposing) { //Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************"); // Must not be run more than once. if (IsDisposed || BeingDisposed) { return; } if (disposing) { // Dispose managed resources here. TeResourceHelper.ShutDownTEResourceHelper(); if (s_notesWindoes != null) { foreach (NotesMainWnd noteWnd in s_notesWindoes.Values) { // The superclass Dispose method will zap it main windows. if (MainWindows != null && !MainWindows.Contains(noteWnd)) { noteWnd.Close(); } } s_notesWindoes.Clear(); } Logger.WriteEvent("Disposing app"); Logger.ShutDown(); } // Dispose unmanaged resources here, whether disposing is true or false. s_AppFeatures = null; base.Dispose(disposing); // NB: Do this after the call to the base method, as any TeMainWnds will want to access them. //s_notesWindoes = null; // Don't null the hashtable, since it doesn't get added by an instance }
public MainWindow() { InitializeComponent(); MainWindows.Navigate(new Warehouse_Display()); }