Exemplo n.º 1
0
        /// <summary> Конструктор </summary>
        public WindowMain()
        {
            InitializeComponent();

            _viewUserAuthorization.IsVisibleChanged += ViewUserAuthorizationOnIsVisibleChanged;

            _viewSecurityKeyChatAccess.IsVisibleChanged += _viewSecurityKeyChatAccess_IsVisibleChanged;

            _viewUserAuthorization.LockWindow += ViewOnLockWindow;

            this.SetResourceReference(TitleProperty, _viewUserAuthorization.WindowCaptionResourceKey);

            GridSecurityKeyGeneratedWinidow.IsVisibleChanged += GridSecurityKeyGenerated_IsVisibleChanged;

            //Кастыль
            GridSecurityKeyGeneratedWinidow.Children.Add(_viewSecurityKeyGenerated);
            GridSecurityKeyGeneratedWinidow.Visibility = Visibility.Collapsed;

            //Кастыль 2
            GridSecurityKeyChatAccessWinidow.Children.Add(_viewSecurityKeyChatAccess);
            GridSecurityKeyChatAccessWinidow.Visibility = Visibility.Collapsed;

            GridAuthorization.Children.Add(_viewUserAuthorization);

            DataContext = new ViewModelMain();

            CurrentMainWindow = this;

            _windowStateBeforeMinimized = WindowState;

            // нужно для организации правой рабочей облачти и рабочей области поверх правой (область для активного вызова)
            GridRightWorkspace.Children.Add(new UIElement());
            //GridRightWorkspace.Children.Add(new UIElement()); // вроде как уже не нужно
        }
Exemplo n.º 2
0
        /// <summary> Метод создания мульти чата </summary>
        private void CreateMultiChat()
        {
            var listModelContact = ViewSelectionContact.ShowSelectionContact();

            if (listModelContact.Count > 0)
            {
                var viewChatMessageDetail = new ViewChatMessageDetail(listModelContact);

                WindowMain.ShowInRightWorkspace(viewChatMessageDetail);

                ViewContact.CurrentViewContact.OpenChat(viewChatMessageDetail.CurrentModelChat);
            }
        }
Exemplo n.º 3
0
        /// <summary> Конструктор </summary>
        public WindowStartup()
        {
            InitializeComponent();

            Title = "DCBF3DE8-032E-4DCA-8158-AE0CF30A15AC" + WindowsIdentity.GetCurrent().Name.Replace(@"\", "-");

            Instance = this;

            _windowMain = FactoryWindow.GetWindowMain();

            // привязка смены языка интерфейса к смене языка в приложении
            LocalizationApp.GetInstance().LocalizationChanged += (sender, language) => OnLocalizationChanged();
            ModelUser.GetInstance().UserStatusChanged         += (sender, args) => OnUserStatusChanged();

            OnLocalizationChanged();

            _itemStatus.DropDownItems.Add(_itemOnline);
            _itemStatus.DropDownItems.Add(_itemDnd);
            _itemStatus.DropDownItems.Add(_itemHidden);
            _itemStatus.DropDownItems.Add(_itemOffline);
            _itemStatus.DropDownItems.Add(new ToolStripSeparator());
            _itemStatus.DropDownItems.Add(_itemSetStatus);

            _itemOnline.Click    += (sender, args) => { ModelUser.GetInstance().ModelEnumUserBaseStatusObj = ModelEnumUserBaseStatus.GetModelEnum(1); _viewModelTray.SaveStatusModelUser(); };
            _itemDnd.Click       += (sender, args) => { ModelUser.GetInstance().ModelEnumUserBaseStatusObj = ModelEnumUserBaseStatus.GetModelEnum(3); _viewModelTray.SaveStatusModelUser(); };
            _itemHidden.Click    += (sender, args) => { ModelUser.GetInstance().ModelEnumUserBaseStatusObj = ModelEnumUserBaseStatus.GetModelEnum(2); _viewModelTray.SaveStatusModelUser(); };
            _itemOffline.Click   += (sender, args) => { ModelUser.GetInstance().ModelEnumUserBaseStatusObj = ModelEnumUserBaseStatus.GetModelEnum(0); _viewModelTray.SaveStatusModelUser(); };
            _itemSetStatus.Click += (sender, args) => SetUserStatus();
            _itemOpen.Click      += (sender, args) => WindowDispacher.GetInstance.ShowAllWindow();
            _itemExit.Click      += (sender, args) => ApplicationExit();

            var ctxmenustrip = new ContextMenuStrip();

            ctxmenustrip.Items.Add(_itemStatus);
            ctxmenustrip.Items.Add(_itemOpen);
            ctxmenustrip.Items.Add(new ToolStripSeparator());
            ctxmenustrip.Items.Add(_itemExit);

            NotifyIcon.ContextMenuStrip = ctxmenustrip;
            NotifyIcon.DoubleClick     += (sender, args) => { WindowDispacher.GetInstance.ShowAllWindow(); };

            _windowMain.ViewUserAuthorizationClosed += WindowMainOnViewUserAuthorizationClosed;

            _windowMain.Show();
        }
        /// <summary> Возвращает окно WindowMain </summary>
        public static WindowMain GetWindowMain()
        {
            var windowDispacher = WindowDispacher.GetInstance;

            var result = windowDispacher.GetWindow(typeof(WindowMain)) as WindowMain;

            if (result != null)
            {
                return(result);
            }

            result = new WindowMain();

            result.Activated += (sender, args) => { windowDispacher.SetActiveWindow(result); };

            windowDispacher.AddToListWindow(result);

            result.Closed += (sender, args) => { windowDispacher.DeleteToListWindow(result); };

            return(result);
        }