Example #1
0
        private void CloseWindow(WindowItem <Model.Policy> policyWindowItem)
        {
            CheckIfRequiredToSaveWork(policyWindowItem);

            IRegion mainRegion = GetMainRegion();

            mainRegion.Remove(policyWindowItem.CurrentView);
            this.windowService.RemoveWindow(policyWindowItem.Key);
        }
Example #2
0
        public WindowItem <TKey> CreateWindow(TKey key, Object currentView)
        {
            var windowItemViewModel = new WindowItem <TKey> {
                CurrentView = currentView, Key = key
            };

            windows.Add(windowItemViewModel);
            this.eventAggregator.GetEvent <WindowAdded <TKey> >().Publish(windowItemViewModel);
            return(windowItemViewModel);
        }
Example #3
0
 private void MoveProcessOutline(Process proc)
 {
     try
     {
         processOutline.UpdateLocation(WindowItem.Create(proc));
     }
     catch (Exception ex)
     {
         LogException(ex);
     }
 }
        static Scene BuildScenes(GameManager gameManager)
        {
            Scene          controlRoom = new StaticScene("Control Room", "The radio sits silently at the front. The grand window stares out into the darkness of space. To the south is the Lab.");
            ConcourseScene concourse   = new ConcourseScene();
            StadiumScene   stadium     = new StadiumScene(gameManager);
            DynamicScene   storage     = new DynamicScene("Storage", "Contains a rope hung by a hook from its wall. The Lab is to the east.");
            RopeItem       ropeItem    = new RopeItem(storage, concourse, stadium);
            LabScene       lab         = new LabScene("Lab", "Four capsules made of glass sit at the side.", "A lectern with buttons stands at the center. To the north is the Control Room.", ropeItem);
            Scene          hall        = new StaticScene("Hall", "East leads to the Concourse. South leads to the Lab.");

            concourse.SetDescription("A large room with multiple tables like a banquet hall. One wall scorched by the bright lights displays space across its massive window. The Hall is to the west.");

            #region Episodes

            #endregion

            #region Directions
            controlRoom.AddWork(new RoamWork(new string[] { RoamWork.South, "LAB" }, lab));
            lab.AddWork(new RoamWork(new string[] { RoamWork.North, "CONTROL", "CONTROL ROOM" }, controlRoom));
            lab.AddWork(new RoamWork(new string[] { RoamWork.East, "HALL" }, hall));
            lab.AddWork(new RoamWork(new string[] { RoamWork.West, "STORAGE" }, storage));
            storage.AddWork(new RoamWork(new string[] { RoamWork.East, "LAB" }, lab));
            hall.AddWork(new RoamWork(new string[] { RoamWork.West, "LAB" }, lab));
            hall.AddWork(new RoamWork(new string[] { RoamWork.East, "CONCOURSE" }, concourse));
            concourse.AddWork(new RoamWork(new string[] { RoamWork.West, "HALL" }, hall));

            // TEST
            //controlRoom.AddWork(new RoamWork(new string[] { "TEST" }, stadium));
            #endregion

            #region Items
            controlRoom.AddItem(new RadioItem());
            controlRoom.AddItem(new WindowItem {
                Description = "The window stares out into the vastness of space. The stars glitter in their reds, blues, and whites."
            });

            {
                CapsuleItem capsuleItem = new CapsuleItem {
                    Description = "Four empty capsules sit against the wall."
                };
                WindowItem windowItem = new WindowItem {
                    Description = "The stars from here are barely visible to the naked eye because of the sharp lights within the Concourse."
                };
                lab.AddItem(capsuleItem);
                lab.AddItem(new LecternItem(lab, concourse, capsuleItem, windowItem));
                concourse.AddItem(windowItem);
            }

            storage.AddItem(new HookItem());
            storage.AddItem(ropeItem);
            #endregion

            return(controlRoom);
        }
Example #5
0
        public static List <WindowItem> VMsToWindowItems(ObservableCollection <WindowItemVM> windowItemVMs)
        {
            List <WindowItem> windowItems = new List <WindowItem>();

            foreach (WindowItemVM windowItemVM in windowItemVMs)
            {
                WindowItem windowItem = VMToWindowItem(windowItemVM);
                windowItems.Add(windowItem);
            }
            return(windowItems);
        }
Example #6
0
 private void DeleteSelectedWindowItem()
 {
     try
     {
         WindowItem item = (WindowItem)ListWindows.SelectedItem;
         Toolbox.settings.RemoveWindow(item);
     }
     catch (Exception ex)
     {
         LogException(ex);
     }
 }
Example #7
0
 /// <summary>
 /// Windows initialization
 /// </summary>
 void InitializeWindows()
 {
     // Make help window, item window
     helpWindow = new WindowHelp();
     itemWindow = new WindowItem();
     // Associate help window
     itemWindow.HelpWindow = helpWindow;
     // Make target window (set to invisible / inactive)
     targetWindow           = new WindowTarget();
     targetWindow.IsVisible = false;
     targetWindow.IsActive  = false;
 }
 protected virtual IList <AccessibleObject> getAccessibleItems()
 {
     if (_accessibleItems == null)
     {
         var w = new WindowItem {
             Handle = SystemUnderTestHandle
         };
         w.WindowAccessibleObjects.ShowIntendedName = true;
         _accessibleItems = w.WindowAccessibleObjects.Items;
     }
     return(_accessibleItems);
 }
Example #9
0
 private void GetSelectedWindowPosition()
 {
     try
     {
         WindowItem windowItem = (WindowItem)ListWindows.SelectedItem;
         Actions.GetWindowItemLocation(windowItem);
         Director.Main.ShowNotification($"Updated Location: {windowItem.WindowName}");
     }
     catch (Exception ex)
     {
         LogException(ex);
     }
 }
Example #10
0
 private void MoveSelectedWindow()
 {
     try
     {
         WindowItem item = (WindowItem)ListWindows.SelectedItem;
         Actions.MoveProcessHandle(item);
         Director.Main.ShowNotification($"Moved Window: {item.WindowName}");
     }
     catch (Exception ex)
     {
         LogException(ex);
     }
 }
        private bool PickWindow()
        {
            var window = _videoSourcePicker.PickWindow(window1 => window1.Handle != _regionProvider.Handle);

            if (window == null)
            {
                return(false);
            }

            _source = new WindowItem(window);

            RaisePropertyChanged(nameof(Source));
            return(true);
        }
Example #12
0
        /// <summary>
        /// 元に戻すボタンが押されたときの処理
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonNoAeroBorder_Click(object sender, EventArgs e)
        {
            WindowItem item = (WindowItem)comboBoxWindowClass.SelectedItem;

            if (item == null)
            {
                return;
            }

            item.Reset();

            UpdateUI();
            UpdateWindow(item);
        }
Example #13
0
    private void Reinforce(WindowItem p_item)
    {
        m_item = p_item;
        m_item.transform.position = transform.position;
        m_item.m_activated        = true;

        if (m_item.CanPasse() == false)
        {
            m_navLink.enabled = false;
        }
        else
        {
            m_navLink.enabled = true;
        }
    }
Example #14
0
 public void UpdateLocation(WindowItem windowItem)
 {
     try
     {
         this.Left   = windowItem.WindowInfo.XValue;
         this.Top    = windowItem.WindowInfo.YValue;
         this.Height = windowItem.WindowInfo.Height;
         this.Width  = windowItem.WindowInfo.Width;
         Toolbox.uAddDebugLog($"Updated Process Outline Location: L{this.Left} T{this.Top} H{this.Height} W{this.Width}");
     }
     catch (Exception ex)
     {
         Toolbox.LogException(ex);
     }
 }
Example #15
0
        private void buttonRightCaptureClick(object sender, EventArgs e)
        {
            var testControl = new TestTestControl();
            var sut         = new TestSystemUnderTest(_hWnd);

            testControl.SystemUnderTest(sut);
            var    contextMenu = new ContextMenu(testControl);
            IntPtr handle      = contextMenu.GetControlDef(null).Play();
            var    wi          = new WindowItem {
                Handle = handle
            };
            List <AccessibleObject> cachedList = wi.WindowAccessibleObjects.Items.ToList();

            listBoxAccObjects.DataSource = cachedList;
        }
Example #16
0
 private void ShowProcessOutline(Process proc)
 {
     try
     {
         WindowItem windowItem = WindowItem.Create(proc);
         if (processOutline == null)
         {
             processOutline = new ProcessOutline(windowItem);
             processOutline.Show();
         }
     }
     catch (Exception ex)
     {
         LogException(ex);
     }
 }
Example #17
0
        private void CheckIfRequiredToSaveWork(WindowItem <Policy.Contracts.Models.Policy> policyWindowItem)
        {
            var policyId       = policyWindowItem.Key.PolicyId;
            var confirmMessage = string.Format("Would you like to save the work before closing for policy Id: {0}?", policyId);

            this.messageBoxService.ShowConfirm(
                confirmMessage,
                () =>
            {
                this.stateService.Save(policyId.ToString());
            },
                () =>
            {
                this.stateService.RemoveContextState(policyId.ToString());
            });
        }
Example #18
0
        /// <summary>
        /// 選択されているウィンドウに合わせてボタンの状態を変更
        /// </summary>
        private void UpdateUI()
        {
            bool  isTransparent  = false;
            bool  isColorKey     = false;
            bool  hasAlpha       = false;
            bool  isTopmost      = false;
            bool  isClickThrough = false;
            Color keyColor       = Color.Black;
            int   opacity        = 100;
            bool  noBorder       = false;

            WindowItem item = (WindowItem)comboBoxWindowClass.SelectedItem;

            if (item != null)
            {
                isTransparent  = item.Transparent;
                isColorKey     = item.ColorKey;
                hasAlpha       = item.HasAlpha;
                isTopmost      = item.Topmost;
                isClickThrough = item.Clickthrough;
                keyColor       = item.KeyColor;
                opacity        = item.Opacity;
                noBorder       = item.NoBorder;

                textBoxDebug.Text = item.DwmAttributes;
                Console.WriteLine(item.DwmAttributes);
            }
            else
            {
                textBoxDebug.Text = "";
            }

            if (!isTransparent && !isColorKey)
            {
                radioButtonDefault.Checked = true;
            }
            radioButtonDwm.Checked       = isTransparent;
            radioButtonChromakey.Checked = isColorKey;
            checkBoxOpacity.Checked      = hasAlpha;
            numericUpDownOpacity.Value   = opacity;

            checkBoxTopmost.Checked      = isTopmost;
            checkBoxClickThrough.Checked = isClickThrough;
            buttonKeyColor.BackColor     = keyColor;
            checkBoxBorder.Checked       = noBorder;
        }
Example #19
0
        public String getChildValuesByRole(uint roleid)
        {
            var sb = new StringBuilder();
            var w  = new WindowItem()
            {
                Handle = SystemUnderTestHandle
            };

            w.WindowAccessibleObjects.ShowIntendedName = false;
            foreach (var item in w.WindowAccessibleObjects.Items)
            {
                if (item.RoleId == roleid)
                {
                    sb.AppendLine(item.Value);
                }
            }
            return(sb.ToString());
        }
Example #20
0
        public static WindowItem NewWindow()
        {
            WindowItem windowItem = new WindowItem
                                    (
                left: 0,
                top: 0,
                width: 400,
                height: 500,
                title: "MDSHO",
                windowBorderColor: Colors.Black.ToInt(),
                titleBackgroundColor: Colors.Black.ToInt(),
                titleBackgroundOpacity: 1.0,
                titleTextColor: Colors.White.ToInt(),
                windowBackgroundColor: Colors.Black.ToInt(),
                windowBackgroundOpacity: 0.7,
                windowTextColor: Colors.White.ToInt()
                                    );

            return(windowItem);
        }
Example #21
0
        private void LoadAccessibleObjects()
        {
            try
            {
                if (!checkBoxGetAccObjects.Checked)
                {
                    return;
                }
                var w = new WindowItem {
                    Handle = _hWnd
                };
                w.WindowAccessibleObjects.ShowIntendedName = true;

                listBoxAccObjects.DataSource = w.WindowAccessibleObjects.Items;
            }
            // ReSharper disable EmptyGeneralCatchClause
            catch
            // ReSharper restore EmptyGeneralCatchClause
            {
            }
        }
Example #22
0
        public static WindowItemVM NewWindow(Screen screen)
        {
            // The default new window model
            WindowItem windowItem = NewData.NewWindow();
            // Position the new window at the center of the screen
            int          left         = screen.Bounds.Left + (screen.Bounds.Width - windowItem.Width) / 2;
            int          top          = screen.Bounds.Top + (screen.Bounds.Height - windowItem.Height) / 2;
            WindowInfoVM windowInfoVM = new WindowInfoVM
                                        (
                title: windowItem.Title,
                windowBorderSolidColorBrush: windowItem.WindowBorderColor.ToColor().ToSolidColorBrush(),
                titleBackgroundSolidColorBrush: windowItem.TitleBackgroundColor.ToColor().ToSolidColorBrush(),
                titleBackgroundOpacity:  windowItem.TitleBackgroundOpacity,
                titleTextSolidColorBrush: windowItem.TitleTextColor.ToColor().ToSolidColorBrush(),
                windowBackgroundSolidColorBrush: windowItem.WindowBackgroundColor.ToColor().ToSolidColorBrush(),
                windowBackgroundOpacity: windowItem.WindowBackgroundOpacity,
                windowTextSolidColorBrush: windowItem.WindowTextColor.ToColor().ToSolidColorBrush()
                                        );
            WindowItemVM windowItemVM = new WindowItemVM(false, left, top, windowItem.Width, windowItem.Height, windowInfoVM);

            return(windowItemVM);
        }
Example #23
0
        public static WindowItemVM WindowItemToVM(WindowItem windowItem)
        {
            WindowItemVM windowItemVM = new WindowItemVM
                                        (
                isClone: false,
                left: windowItem.Left,
                top: windowItem.Top,
                width: windowItem.Width,
                height: windowItem.Height,
                windowInfoVM: new WindowInfoVM
                (
                    title: windowItem.Title,
                    windowBorderSolidColorBrush: windowItem.WindowBorderColor.ToColor().ToSolidColorBrush(),
                    titleBackgroundSolidColorBrush: windowItem.TitleBackgroundColor.ToColor().ToSolidColorBrush(),
                    titleBackgroundOpacity: windowItem.TitleBackgroundOpacity,
                    titleTextSolidColorBrush: windowItem.TitleTextColor.ToColor().ToSolidColorBrush(),
                    windowBackgroundSolidColorBrush: windowItem.WindowBackgroundColor.ToColor().ToSolidColorBrush(),
                    windowBackgroundOpacity: windowItem.WindowBackgroundOpacity,
                    windowTextSolidColorBrush: windowItem.WindowTextColor.ToColor().ToSolidColorBrush()
                )
                                        );

            // Convert Items to ItemVMs
            windowItemVM.RootItemVMs = ItemsToVMs(windowItem.Items);
            // Convert WindowClones to WindowItemVMClones
            foreach (WindowClone windowClone in windowItem.WindowClones)
            {
                WindowItemVM windowItemVMClone = new WindowItemVM(
                    true,
                    windowClone.Left,
                    windowClone.Top,
                    windowClone.Width,
                    windowClone.Height,
                    windowItemVM.WindowInfoVM);
                windowItemVMClone.RootItemVMs = windowItemVM.RootItemVMs;
                windowItemVM.WindowItemVMClones.Add(windowItemVMClone);
            }
            return(windowItemVM);
        }
Example #24
0
		public bool RegistWindow(string name, Form window, ModuleBase module)
		{
			WindowItem wi = new WindowItem();
			wi.Name = name;
			wi.Window = window;
			Windows.Add(wi);
			return true;
		}
Example #25
0
 public void CloseWindow(WindowItem <T> windowItem)
 {
     eventAggregator.GetEvent <WindowClose <T> >().Publish(windowItem);
 }
Example #26
0
 public void OpenWindow(WindowItem <T> windowItem)
 {
     eventAggregator.GetEvent <WindowOpen <T> >().Publish(windowItem);
 }
Example #27
0
 public void RemoveWindowItem(WindowItem <T> windowItem)
 {
     Windows.Remove(windowItem);
 }
Example #28
0
 public void AddWindowItem(WindowItem <T> windowItem)
 {
     Windows.Add(windowItem);
 }
Example #29
0
        public void AddNewItem()
        {
            WindowItem window = new WindowItem();

            windows.Add(window);
        }
Example #30
0
        /// <summary>
        /// ウィンドウを再描画させる
        /// </summary>
        /// <param name="item"></param>
        private void UpdateWindow(WindowItem item)
        {
            long ws;
            long wsex;

            IntPtr hWnd = item.Handle;

            if (!WinApi.IsWindow(hWnd))
            {
                comboBoxWindowClass.Items.Remove(item);
                return; // ウィンドウが存在しない
            }

            ws   = item.OriginalStyles;
            wsex = item.OriginalExStyles;

            // ウィンドウスタイルを初期状態に一度戻す
            WinApi.SetWindowLong(hWnd, WinApi.GWL_EXSTYLE, wsex);
            WinApi.SetWindowLong(hWnd, WinApi.GWL_STYLE, ws);

            // 操作を透過させる(受け付けなくする)
            if (item.Clickthrough)
            {
                wsex |= WinApi.WS_EX_LAYERED;
                wsex |= WinApi.WS_EX_TRANSPARENT;
            }

            if (item.ColorKey || item.HasAlpha)
            {
                wsex |= WinApi.WS_EX_LAYERED;
            }

            if (item.NoBorder)
            {
                // 枠無しウィンドウにする
                ws &= ~WinApi.WS_OVERLAPPEDWINDOW;
            }

            // ウィンドウスタイルを適用
            WinApi.SetWindowLong(hWnd, WinApi.GWL_EXSTYLE, wsex);
            WinApi.SetWindowLong(hWnd, WinApi.GWL_STYLE, ws);

            byte alpha = 0xFF;

            if (item.HasAlpha)
            {
                alpha = (byte)(0xFF * item.Opacity / 100);
            }

            if (item.ColorKey || item.HasAlpha)
            {
                uint            flags = (item.ColorKey ? WinApi.LWA_COLORKEY : 0) | (item.HasAlpha? WinApi.LWA_ALPHA : 0);
                WinApi.COLORREF crKey = new WinApi.COLORREF(item.KeyColor.R, item.KeyColor.G, item.KeyColor.B);
                WinApi.SetLayeredWindowAttributes(hWnd, crKey, alpha, flags);
            }
            else
            {
                //WinApi.SetLayeredWindowAttributes(hWnd, new WinApi.COLORREF(0), 0xFF, 0);
            }

            WinApi.RECT rect;
            WinApi.GetWindowRect(hWnd, out rect);

            // 一度強制的にリサイズをする
            WinApi.SetWindowPos(
                hWnd,
                (item.Topmost ? WinApi.HWND_TOPMOST : WinApi.HWND_NOTOPMOST),
                rect.left, rect.top,
                (rect.right - rect.left + 1), (rect.bottom - rect.top),
                WinApi.SWP_NOMOVE | WinApi.SWP_NOZORDER | WinApi.SWP_FRAMECHANGED | WinApi.SWP_NOOWNERZORDER | WinApi.SWP_NOACTIVATE | WinApi.SWP_ASYNCWINDOWPOS
                );

            // 再描画と同時に最前面状態を切り替え
            WinApi.SetWindowPos(
                hWnd,
                (item.Topmost? WinApi.HWND_TOPMOST : WinApi.HWND_NOTOPMOST),
                rect.left, rect.top,
                (rect.right - rect.left), (rect.bottom - rect.top),
                WinApi.SWP_ASYNCWINDOWPOS | WinApi.SWP_FRAMECHANGED | WinApi.SWP_NOCOPYBITS | WinApi.SWP_NOACTIVATE | WinApi.SWP_SHOWWINDOW
                );

            // 透明化状態を切り替え
            if (item.Transparent)
            {
                if (!item.IsChild)
                {
                    // エアロによる透明化範囲を全体に適用
                    DwmApi.DwmExtendIntoClientAll(hWnd);
                }
            }
            else
            {
                if (!item.IsChild)
                {
                    // DWMによる透明化範囲をなくす
                    DwmApi.MARGINS margins = new DwmApi.MARGINS(0, 0, 0, 0);
                    DwmApi.DwmExtendFrameIntoClientArea(hWnd, ref margins);

                    //DwmApi.DwmSetWindowAttribute(hWnd, DwmApi.DWMWINDOWATTRIBUTE.DWMWA_NCRENDERING_POLICY, DwmApi.DWMNCRENDERINGPOLICY.DWMNCRP_DISABLED, Marshal.SizeOf(typeof(int)));
                }
            }
        }
Example #31
0
 private void RemoveReinforcement()
 {
     m_navLink.enabled  = true;
     m_item.m_activated = false;
     m_item             = null;
 }