Ejemplo n.º 1
0
        private void initialize()
        {
            IsStarting = true;

            try
            {
                CairoLogger.Instance.Debug("Starting WindowsTasksService");

                // create window to receive task events
                _HookWin = new NativeWindowEx();
                _HookWin.CreateHandle(new CreateParams());

                // prevent other shells from working properly
                SetTaskmanWindow(_HookWin.Handle);

                // register to receive task events
                RegisterShellHookWindow(_HookWin.Handle);
                WM_SHELLHOOKMESSAGE         = RegisterWindowMessage("SHELLHOOK");
                WM_TASKBARCREATEDMESSAGE    = RegisterWindowMessage("TaskbarCreated");
                TASKBARBUTTONCREATEDMESSAGE = RegisterWindowMessage("TaskbarButtonCreated");
                _HookWin.MessageReceived   += ShellWinProc;

                // set window for ITaskbarList
                setTaskbarListHwnd();

                // adjust minimize animation
                SetMinimizedMetrics();

                // prepare collections
                groupedWindows = CollectionViewSource.GetDefaultView(Windows);
                groupedWindows.GroupDescriptions.Add(new PropertyGroupDescription("Category"));
                groupedWindows.CollectionChanged += groupedWindows_Changed;
                groupedWindows.Filter             = groupedWindows_Filter;
                var taskbarItemsView = groupedWindows as ICollectionViewLiveShaping;
                taskbarItemsView.IsLiveFiltering = true;
                taskbarItemsView.LiveFilteringProperties.Add("ShowInTaskbar");
                taskbarItemsView.IsLiveGrouping = true;
                taskbarItemsView.LiveGroupingProperties.Add("Category");

                // enumerate windows already opened
                EnumWindows(new CallBackPtr((hwnd, lParam) =>
                {
                    ApplicationWindow win = new ApplicationWindow(hwnd, this);
                    if (win.ShowInTaskbar && !Windows.Contains(win))
                    {
                        Windows.Add(win);
                    }
                    return(true);
                }), 0);

                // register for app grabber changes so that our app association is accurate
                AppGrabber.AppGrabber.Instance.CategoryList.CategoryChanged += CategoryList_CategoryChanged;
            }
            catch (Exception ex)
            {
                CairoLogger.Instance.Info("Unable to start WindowsTasksService: " + ex.Message);
            }

            IsStarting = false;
        }
Ejemplo n.º 2
0
        private ApplicationWindow addWindow(IntPtr hWnd, ApplicationWindow.WindowState initialState = ApplicationWindow.WindowState.Inactive, bool sanityCheck = false)
        {
            ApplicationWindow win = new ApplicationWindow(this, hWnd);

            // set window state if a non-default value is provided
            if (initialState != ApplicationWindow.WindowState.Inactive)
            {
                win.State = initialState;
            }

            // add window unless we need to validate it is eligible to show in taskbar
            if (!sanityCheck || win.CanAddToTaskbar)
            {
                Windows.Add(win);
            }

            // Only send TaskbarButtonCreated if we are shell, and if OS is not Server Core
            // This is because if Explorer is running, it will send the message, so we don't need to
            if (EnvironmentHelper.IsAppRunningAsShell)
            {
                sendTaskbarButtonCreatedMessage(win.Handle);
            }

            return(win);
        }
Ejemplo n.º 3
0
        public SeleniumManager(BrowserType browserType = BrowserType.Ie)
        {
            switch (browserType)
            {
            case BrowserType.Firefox:
                driver = new FirefoxDriver();
                break;

            case BrowserType.Ie:
                var options = new InternetExplorerOptions
                {
                    IntroduceInstabilityByIgnoringProtectedModeSettings = true,
                    IgnoreZoomLevel = true
                };
                driver = new InternetExplorerDriver(options);
                break;

            case BrowserType.Chrome:
                driver = new ChromeDriver(ConfigurationManager.AppSettings["ChromeDriverLocation"]);
                break;

            default:
                driver = new FirefoxDriver();
                break;
            }
            // driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromMilliseconds(10000));
            var browser = new SeleniumBrowser();

            browser.Name = driver.CurrentWindowHandle;
            Windows.Add(browser);
        }
Ejemplo n.º 4
0
        private ApplicationWindow addWindow(IntPtr hWnd, ApplicationWindow.WindowState initialState = ApplicationWindow.WindowState.Inactive, bool sanityCheck = false)
        {
            ApplicationWindow win = new ApplicationWindow(hWnd, this);

            // set window state if a non-default value is provided
            if (initialState != ApplicationWindow.WindowState.Inactive)
            {
                win.State = initialState;
            }

            // add window unless we need to validate it is eligible to show in taskbar
            if (!sanityCheck || win.CanAddToTaskbar)
            {
                Windows.Add(win);
            }

            // Only send TaskbarButtonCreated if we are shell, and if OS is not Server Core
            // This is because if Explorer is running, it will send the message, so we don't need to
            // Server Core doesn't support ITaskbarList, so sending this message on that OS could cause some assuming apps to crash
            if (Interop.Shell.IsCairoRunningAsShell && !Interop.Shell.IsServerCore)
            {
                SendNotifyMessage(win.Handle, (uint)TASKBARBUTTONCREATEDMESSAGE, UIntPtr.Zero, IntPtr.Zero);
            }

            return(win);
        }
Ejemplo n.º 5
0
        public VirtualDataWindow Create(VirtualDataWindowContext context)
        {
            var vdw = new SupportVirtualDW(context);

            Windows.Add(vdw);
            return(vdw);
        }
Ejemplo n.º 6
0
        // Получение списка плиток в определении блока
        private void IterateBtrEnt()
        {
            _tiles  = new List <Tile>();
            _paints = new List <Paint>();

            var btrMarkSb = _idBtr.GetObject(OpenMode.ForRead) as BlockTableRecord;

            foreach (ObjectId idEnt in btrMarkSb)
            {
                if (idEnt.IsValidEx() && idEnt.ObjectClass.Name == "AcDbBlockReference")
                {
                    var    blRef  = idEnt.GetObject(OpenMode.ForRead, false, true) as BlockReference;
                    string blName = blRef.GetEffectiveName();
                    // Плитка
                    if (blName.Equals(Settings.Default.BlockTileName, StringComparison.OrdinalIgnoreCase))
                    {
                        Tile tile = new Tile(blRef, blName);
                        //Определение покраски плитки
                        Paint paint = ColorArea.GetPaint(tile.CenterTile, _rtreeColorArea);
                        _tiles.Add(tile);
                        _paints.Add(paint);
                    }
                    // Окна
                    else if (BlockWindow.IsblockWindow(blName))
                    {
                        BlockWindow window = new BlockWindow(blRef, blName, this);
                        Windows.Add(window);
                    }
                }
            }
        }
        public void OpenTransmittal(TransmittalViewModel view)
        {
            try
            {
                if (view.Id != 0) //if view already exists make it active
                {
                    foreach (IDockElement window in Windows)
                    {
                        if (window is TransmittalViewModel tran)
                        {
                            if (tran.Id == view.Id)
                            {
                                ActiveDoc = window;
                                return;
                            }
                        }
                    }
                }

                //Otherwise make it presmt
                view.RequestToClose += View_RequestToClose; //Add a close notify
                Windows.Add(view);                          //add view to collection
                ActiveDoc = view;                           //activate view
            }
            catch (Exception ex)
            {
#if DEBUG
                Debugger.Break();
#endif
            }
        }
Ejemplo n.º 8
0
        public SierraVgaController(AssetManager assets, IMouse mouse)
            : base(assets, mouse)
        {
            this.Assets.RootDirectory = "Content/Gui/Sierra Vga";
            Mouse.Cursor = Cursors.Walk;
            Mouse.SaveCursorToBackup();
            Mouse.ButtonUp += MouseControllerOnButtonUp;

            StatusBar             = new StatusBar(assets);
            StatusBar.MouseEnter += TopBarOnMouseEnter;

            VerbBar             = new VerbBar(assets);
            VerbBar.MouseLeave += VerbBarOnMouseLeave;

            TextBox = new TextBox(assets);

            Rest = new Rest(assets);

            ExtensionBar = new ExtensionBar(assets);

            Windows.Add(StatusBar);
            Windows.Add(VerbBar);
            Dialogs.Add(TextBox);
            Dialogs.Add(Rest);
            Dialogs.Add(ExtensionBar);
        }
Ejemplo n.º 9
0
        protected override void OpenWindow(AppBarScreen screen)
        {
            MenuBar newMenuBar = new MenuBar(_cairoApplication, _shellManager, _windowManager, _appGrabber, _updateService, _settingsUiService, screen, AppBarEdge.Top);

            Windows.Add(newMenuBar);
            newMenuBar.Show();
        }
Ejemplo n.º 10
0
        /// <summary>
        /// 创建魔塔世界窗口实例
        /// </summary>
        private MotaWorld()
            : base(GameIni.WindowWidth, GameIni.WindowHeight)
        {
            //魔塔地图窗口
            Windows.Add(new MainGame());

            //物品获取消息窗口
            Windows.Add(new GoodsMessage());

            //楼层跳转窗口
            Windows.Add(new FloorFlash(new Bitmap("images/map/FloorMove.png")));

            //消息提示窗口
            Windows.Add(new MessageShow());

            //楼层跳转窗口
            Windows.Add(new FloorSkip());

            //对话窗口
            Windows.Add(new DialogueBox());

            //商店窗口
            Windows.Add(new Shop());

            //战斗窗口
            Windows.Add(new BattleBox());

            //怪物手册
            Windows.Add(new MonsterBook());

            //怪物数据窗口
            Windows.Add(new MiniBook());

            CanAuto = true;
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Shows the script diagram panel for the given <see cref="tree"/> identifier
        /// </summary>
        /// <param name="tree">Dialog Tree to show</param>
        public void ShowScriptDiagramPanel(DialogTreeIdentifier tree)
        {
            DialogTree dialogTree = m_project[tree];

            if (dialogTree == null)
            {
                return;
            }

            ScriptDiagramVM window = Windows.Select(w => w as ScriptDiagramVM)
                                     .Where(s => s != null)
                                     .FirstOrDefault(s => s.Tree == tree);

            if (window == null)
            {
                window = new ScriptDiagramVM(m_project, dialogTree);
                Windows.Add(window);
            }

            window.IsSelected = true;
            if (m_dockingManager != null)
            {
                m_dockingManager.ActiveContent = window;
            }
        }
Ejemplo n.º 12
0
 private void addWindow(ApplicationWindow win)
 {
     if (win.ShowInTaskbar && !Windows.Contains(win))
     {
         Windows.Add(win);
     }
 }
Ejemplo n.º 13
0
 private void addWindow(ApplicationWindow win)
 {
     if (!Windows.Contains(win))
     {
         Windows.Add(win);
     }
 }
Ejemplo n.º 14
0
        private void ShowWindow(Type type)
        {
            LayoutContent panel = Windows.FirstOrDefault(p => p.GetType() == type);

            if (panel != null)
            {
                panel.IsSelected = true;
                panel.IsActive   = true;
                if (m_dockingManager != null)
                {
                    m_dockingManager.ActiveContent = panel;
                }
                return;
            }

            if (type == typeof(ProjectOverviewVM))
            {
                panel = new ProjectOverviewVM(m_project);
            }
            else if (type == typeof(LogPanelVM))
            {
                panel = new LogPanelVM();
            }
            else
            {
                Logging.Logger.Warn($"Tried to show unknown panel: {type.FullName}");
                return;
            }

            Logging.Logger.Info($"Adding new panel '{panel.Title}' based on requested type: {type.FullName}");
            Windows.Add(panel);
        }
Ejemplo n.º 15
0
        protected override void OpenWindow(AppBarScreen screen)
        {
            Taskbar newTaskbar = new Taskbar(_cairoApplication, _shellManager, _windowManager, _desktopManager, _appGrabber, screen, Settings.Instance.TaskbarPosition == 1 ? AppBarEdge.Top : AppBarEdge.Bottom);

            Windows.Add(newTaskbar);
            newTaskbar.Show();
        }
Ejemplo n.º 16
0
        private void getInitialWindows()
        {
            EnumWindows((hwnd, lParam) =>
            {
                ApplicationWindow win = new ApplicationWindow(hwnd);

                // set window category if provided by shell
                win.Category = TaskCategoryProvider?.GetCategory(win);

                if (win.CanAddToTaskbar && win.ShowInTaskbar && !Windows.Contains(win))
                {
                    Windows.Add(win);
                }

                return(true);
            }, 0);

            IntPtr hWndForeground = GetForegroundWindow();

            if (Windows.Any(i => i.Handle == hWndForeground && i.ShowInTaskbar))
            {
                ApplicationWindow win = Windows.First(wnd => wnd.Handle == hWndForeground);
                win.State = ApplicationWindow.WindowState.Active;
                win.SetShowInTaskbar();
            }
        }
Ejemplo n.º 17
0
        internal void EnumerateWindows()
        {
            var results = new List <WindowModel>();

            foreach (var process in Process.GetProcesses()
                     .Where(x => x.MainWindowHandle != IntPtr.Zero && !string.IsNullOrEmpty(x.MainWindowTitle))
                     .OrderBy(x => x.MainWindowTitle))
            {
                foreach (ProcessThread thread in process.Threads)
                {
                    EnumThreadWindows(thread.Id, (handle, ptr) =>
                    {
                        var model = GetWindowModel(handle);
                        if (model != null)
                        {
                            results.Add(model);
                        }
                        return(true);
                    }, IntPtr.Zero);
                }
            }

            Windows.Clear();
            results.ForEach(model => Windows.Add(model));
        }
Ejemplo n.º 18
0
        private int i = 0; //Sert pour le temps(pluie neige ...)

        public GameScreen()
        {
            timeSpawn    = 10000;
            WorldEffects = new List <WorldEffect>();

            Player = new Player(this, TexturesManager.Player); // Charge le Joueur

            Windows.Add(new PanelMenu(this, new Vector2(0, MainGame.ScreenY / 2), TexturesManager.Window, Player));
            escapeMenu = new EscapeMenu(this, new Vector2(100, MainGame.ScreenY / 4 + 50));

            IsPaused = false;

            Entities        = new List <Entity>();
            deletedEntities = new List <Entity>(); // On transfere un Monster deleted a l'interieur puis on le detruit dans cette liste

            MapData mapData = new MapData();

            if (!mapData.FromFile("Content/Maps/map.mrm"))
            {
                throw new Exception();
            }
            MapFirst = new Map(mapData);

            camera = new Cam(mapData.MapWidth * 32, mapData.MapHeight * 32, MainGame.graphics);
        }
Ejemplo n.º 19
0
        private void getInitialWindows()
        {
            EnumWindows((hwnd, lParam) =>
            {
                ApplicationWindow win = new ApplicationWindow(this, hwnd);

                if (win.CanAddToTaskbar && win.ShowInTaskbar && !Windows.Contains(win))
                {
                    Windows.Add(win);

                    sendTaskbarButtonCreatedMessage(win.Handle);
                }

                return(true);
            }, 0);

            IntPtr hWndForeground = GetForegroundWindow();

            if (Windows.Any(i => i.Handle == hWndForeground && i.ShowInTaskbar))
            {
                ApplicationWindow win = Windows.First(wnd => wnd.Handle == hWndForeground);
                win.State = ApplicationWindow.WindowState.Active;
                win.SetShowInTaskbar();
            }
        }
Ejemplo n.º 20
0
        public void IncrementWindow(string title, int lastAction, int timeInc)
        {
            if (Windows.All(o => o.Title != title))
            {
                var timeSlot = new TimeSlot(title);
                timeSlot.PropertyChanged += TimeSlot_PropertyChanged;
                timeSlot.Seconds          = timeInc;
                Windows.Add(timeSlot);
                return;
            }

            foreach (var timeSlot in Windows.Where(timeSlot => timeSlot.Title == title))
            {
                if (lastAction < 1)
                {
                    timeSlot.Seconds += timeInc;
                    timeSlot.TransferPotentialTime();
                }
                else
                {
                    timeSlot.PotentialSeconds += timeInc;
                }

                break;
            }

            PropChanged("IncludedTime");
            PropChanged("ExcludedTime");
            PropChanged("TotalTime");
        }
Ejemplo n.º 21
0
        public int EnumWindowsCallback(int hWnd, int lParam)
        {
            Window Window;

            int RetValue;
            int RetValueWL;

            // Check if the window has any Owner, we do not need
            // multiple Windows of an Application.
            RetValue   = API.GetWindow(hWnd, API.GW_OWNER);
            RetValueWL = API.GetWindowLong(hWnd, API.GWL_STYLE);

            // If the handle belongs to our application lets not display it
            //If hWnd = fInstance.Handle.ToInt32 Then RetValue = -1

            if (API.IsWindowVisible(hWnd) == 1)
            {
                if (RetValue == 0 && (RetValueWL & API.WS_SYSMENU) != 0)
                {
                    // Initialize a new Window Object
                    Window = new Window(new IntPtr(hWnd));

                    // Add the Window Item to the collection
                    Windows.Add(Window.Handle.ToString(), Window);
                }
            }

            // Return 1, so that the loop continues until the last window
            return(1);
        }
Ejemplo n.º 22
0
        void WindowManager_WindowListChanged(object sender, EventArgs e)
        {
            List <IntPtr> hwnds = new List <IntPtr>();

            WindowInterop.EnumWindows((h, p) =>
            {
                if (isTaskBarWindow(h))
                {
                    hwnds.Add(h);
                }
                return(true);
            }, 0);
            List <IntPtr> chwnds = (from w in Windows select w.Hwnd).ToList();

            foreach (var h in hwnds.Except(chwnds)) // Get removed windows
            {
                Window window = new Window(h);
                Windows.Add(window);
                if (WindowAdded != null)
                {
                    WindowAdded(this, new WindowEventArgs(window));
                }
            }
            foreach (var h in chwnds.Except(hwnds)) // Get added windows
            {
                Window window = Windows.Find(w => w.Hwnd == h);
                if (WindowRemoved != null)
                {
                    WindowRemoved(this, new WindowEventArgs(window));
                }
                Windows.Remove(window);
            }
        }
Ejemplo n.º 23
0
        public void AddWindow(DesktopWindow desktopWindow)
        {
            Pair <string, string> configurableFilter = ConfigurableFilters.FirstOrDefault(f => f.Item1 == desktopWindow.AppName);

            if (!Windows.ContainsKey(desktopWindow.GetDesktopMonitor()))
            {
                Windows.Add(desktopWindow.GetDesktopMonitor(), new ObservableCollection <DesktopWindow>());
                Windows[desktopWindow.GetDesktopMonitor()].CollectionChanged += Windows_CollectionChanged;
            }

            if (FixedFilters.All(s => !desktopWindow.AppName.StartsWith(s)) &&
                desktopWindow.AppName != String.Empty &&
                !Windows[desktopWindow.GetDesktopMonitor()].Contains(desktopWindow))
            {
                if (configurableFilter.Equals(null))
                {
                    Windows[desktopWindow.GetDesktopMonitor()].Add(desktopWindow);
                }
                else
                {
                    if (configurableFilter.Item2 != "*" && configurableFilter.Item2 != desktopWindow.ClassName)
                    {
                        Windows[desktopWindow.GetDesktopMonitor()].Add(desktopWindow);
                    }
                }
            }
        }
Ejemplo n.º 24
0
         public MainWindow()
         {
             InitializeComponent();
 
             string ver = Assembly.GetExecutingAssembly().GetName().Version.ToString();
             Windows.Add(new MyMenuItem { Title = "Version" + ver });
         }
Ejemplo n.º 25
0
        public FileMenu(IGamePersistance gamePersistance)
        {
            files.AddRange(gamePersistance.FindExistingGames());

            filesWindow.Location = new Point(11, 8);

            Windows.Add(filesWindow);
        }
Ejemplo n.º 26
0
        public IWindow Create(Size size, IViewModel viewModel)
        {
            var window = _windowBuilder(viewModel);

            Windows.Add(window);
            new Thread(() => window.Run(size)).Start();
            return(window);
        }
Ejemplo n.º 27
0
        public void AddWindow()
        {
            Windows.Add(new Entities.Window(new Rect(tiles.First())));

            if (Windows.Any(w => w.Selected) == false)
            {
                Windows.First().Selected = true;
            }
        }
Ejemplo n.º 28
0
        public void Update(WindowUpdate windowUpdate)
        {
            if (_isDisposed)
            {
                return;
            }

            lock (_listLock)
            {
                foreach (var windowInformation in windowUpdate.UpdatedWindows)
                {
                    Windows.FirstOrDefault(x => x.Handle == windowInformation.Handle)?.UpdateData(windowInformation);
                }

                foreach (var windowInformation in windowUpdate.NewWindows)
                {
                    if (Windows.All(x => x.Handle != windowInformation.Handle))
                    {
                        Windows.Add(new WindowRenderInfo(windowInformation));
                    }
                }

                foreach (var windowToRemove in Windows.Where(x => !windowUpdate.AllWindows.Contains(x.Handle)).ToList()) //ToList is important to allow removing from the list
                {
                    Windows.Remove(windowToRemove);
                }

                Windows =
                    new List <WindowRenderInfo>(windowUpdate.AllWindows.Where(
                                                    x => Windows.Any(y => y.Handle == x))
                                                .Select(x => Windows.FirstOrDefault(y => y.Handle == x)));

                /*var windowsIndex = 0;
                 * for (int i = 0; i < windowUpdate.AllWindows.Count; i++)
                 * {
                 *  var windowHandle = windowUpdate.AllWindows[i];
                 *  var existingWindow = Windows.FirstOrDefault(x => x.Handle == windowHandle);
                 *  if (existingWindow == null)
                 #if DEBUG
                 *      throw new Exception("Window does not exist");
                 #else
                 *      continue;
                 #endif
                 *
                 *  Windows.Move(Windows.IndexOf(existingWindow), windowsIndex);
                 *  windowsIndex++;
                 * }*/

                if (windowUpdate.RenderedWindow != null)
                {
                    var windowToUpdate = Windows.FirstOrDefault(x => x.Handle == windowUpdate.RenderedWindowHandle);
                    windowToUpdate?.UpdateImage(windowUpdate.RenderedWindow);
                }
            }

            _updateReceivedAutoResetEvent.Set();
        }
Ejemplo n.º 29
0
        SimpleViewModelBase GetViewModel <VMType>() where VMType : SimpleViewModelBase
        {
            var viewModel = _viewModelFactory.GetInstance <VMType>();

            if (!Windows.Contains(viewModel))
            {
                Windows.Add(viewModel);
            }
            return(viewModel);
        }
Ejemplo n.º 30
0
 public MainWindow()
 {
     InitializeComponent();
     Windows.Add(new MyObject {
         Title = "Collection Item 1"
     });
     Windows.Add(new MyObject {
         Title = "Collection Item 2"
     });
 }