Пример #1
0
        public void Show(TransientProfileStatusesViewModel viewModel)
        {
            if (viewModel == null)
            {
                throw new ArgumentNullException(nameof(viewModel));
            }

            var view = new ProfileStatusesView();

            view.DataContext = viewModel;
            var profileStatusesWindow = new GenericElementHostWindow();

            profileStatusesWindow.Text         = "Synchronization Status";
            profileStatusesWindow.Icon         = Resources.ApplicationIcon;
            profileStatusesWindow.ShowIcon     = true;
            profileStatusesWindow.BackColor    = SystemColors.Window;
            profileStatusesWindow.Child        = view;
            profileStatusesWindow.Size         = new Size(400, 300);
            profileStatusesWindow.FormClosing += (sender, e) =>
            {
                viewModel.OnViewClosing();
            };
            viewModel.RequestingBringToFront += (sender, e) =>
            {
                profileStatusesWindow.BringToFront();
            };
            profileStatusesWindow.Show();
        }
Пример #2
0
        public UiService(ProfileStatusesViewModel viewModel)
        {
            if (viewModel == null)
            {
                throw new ArgumentNullException(nameof(viewModel));
            }

            var view = new ProfileStatusesView();

            view.DataContext                    = viewModel;
            _profileStatusesWindow              = new GenericElementHostWindow();
            _profileStatusesWindow.Text         = "Synchronization Status";
            _profileStatusesWindow.Icon         = Resources.ApplicationIcon;
            _profileStatusesWindow.ShowIcon     = true;
            _profileStatusesWindow.BackColor    = SystemColors.Window;
            _profileStatusesWindow.Child        = view;
            _profileStatusesWindow.Size         = new Size(400, 300);
            _profileStatusesWindow.FormClosing += (sender, e) =>
            {
                e.Cancel = true;
                _profileStatusesWindow.Visible = false;
            };
        }