Ejemplo n.º 1
0
        private void Showman_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            if (e.PropertyName == nameof(GameAccount.AccountType))
            {
                UpdateShowman();
                return;
            }

            if (e.PropertyName == nameof(GameAccount.SelectedAccount))
            {
                if (_showman.SelectedAccount == _computerShowmans.Last()) // Новый ведущий
                {
                    var account = new ComputerAccount {
                        CanBeDeleted = true
                    };
                    var newShowmanAccount = new ShowmanViewModel(account);
                    newShowmanAccount.Add += NewShowmanAccount_Add;
                    var contentBox = new ContentBox {
                        Data = newShowmanAccount, Title = Resources.NewShowman, Cancel = _closeNewShowman
                    };
                    Navigate?.Invoke(contentBox);

                    return;
                }

                _model.Showman = _showman.SelectedAccount;
                CheckUniqueAccounts();
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Raises event 'Navigate'
 /// </summary>
 protected virtual void OnNavigate()
 {
     if (Navigate != null)
     {
         Navigate.Invoke(this, System.EventArgs.Empty);
     }
 }
Ejemplo n.º 3
0
 private void NavViewEx_Loaded(object sender, RoutedEventArgs e)
 {
     if (FindStart() is NavigationViewItem i && i != null)
     {
         Navigate.Invoke(Frame, i.GetValue(NavProperties.PageTypeProperty) as Type);
     }
     IsPaneOpenChanged(this, null);
     UpdateBackButton();
     UpdateHeader();
 }
Ejemplo n.º 4
0
        private void EditComputerAccount_Executed(object arg)
        {
            var computerAccount    = (ComputerAccount)arg;
            var newComputerAccount = new ComputerAccountViewModel(computerAccount.Clone(), computerAccount);

            newComputerAccount.Add += NewComputerAccount_Edit;
            var contentBox = new ContentBox {
                Data = newComputerAccount, Title = Resources.ComputerPlayer
            };

            Navigate?.Invoke(contentBox);
        }
Ejemplo n.º 5
0
 private void OnSignIn(object obj)
 {
     if (!CodeAnalysisServiceClient.SignIn(SignInModel.UserName, SignInModel.Password))
     {
         MessageBox.Show("Invalid Username or Password");
     }
     else
     {
         UpdateUserName.Invoke(SignInModel.UserName);
         Navigate.Invoke(ViewPages.ToolRun);
     }
 }
Ejemplo n.º 6
0
        public void NavigateTo(EAreaType areaType, Object data = null)
        {
            var            eventData = new CAreaNavigateEventArgs(areaType, data);
            ContentControl control   = GetContentControl(areaType);

            if (control.DataContext is ViewModelBase vm)
            {
                vm.OnNavigated(data);
            }
            Navigate?.Invoke(this, control);
            //_navigationItems.Push(new CNavigationHistoryItem(pageType, targetId));
        }
Ejemplo n.º 7
0
 private void InflateSubPages(List <Config.Node> subPages)
 {
     foreach (var page in subPages)
     {
         var view = new NavigatorView(page);
         view.Navigate += delegate(string url)
         {
             Navigate?.Invoke(url);
         };
         SubPagesContainer.Children.Add(view);
     }
     FoldButton.Visibility = SubPagesContainer.Children.Count > 0 ? Visibility.Visible : Visibility.Collapsed;
 }
Ejemplo n.º 8
0
        private void GetResult()
        {
            bool result;

            ToolStatusModel.StatusMessage = "Almost done. Minions are Putting Finishing Touches on the Report....";
            ToolStatusModel.StatusImage   = "../Images/GetResult.png";
            if (!ToolRunModel.GateType)
            {
                result = CodeAnalysisServiceClient.GetResult(-1, ToolRunModel.SelectedTool, ToolRunModel.RepoPath, ToolRunModel.Branch);
            }
            else
            {
                result = CodeAnalysisServiceClient.GetResult(ToolRunModel.GateThreshold, ToolRunModel.SelectedTool, ToolRunModel.RepoPath, ToolRunModel.Branch);
            }
            UpdateResult(result);
            Navigate.Invoke(ViewPages.Results);
        }
Ejemplo n.º 9
0
 public NavigatorView(Config.Node page)
 {
     InitializeComponent();
     this.Name.Content = page.PageName;
     if (page.PageUrl != null)
     {
         Body.MouseEnter += Body_MouseEnter;
         Body.MouseLeave += Body_MouseLeave;
         Body.MouseDown  += delegate(object sender, MouseButtonEventArgs e)
         {
             Navigate?.Invoke(page.PageUrl);
             e.Handled = true;
         };
     }
     Body.Background = defaultBackgroundBrush;
     InflateSubPages(page.SubPages);
 }
Ejemplo n.º 10
0
        private void SelectPackage_Executed(object arg)
        {
            var code = (PackageSourceTypes)arg;

            switch (code)
            {
            case PackageSourceTypes.Next:
                Package = new NextPackageSource();
                break;

            case PackageSourceTypes.Random:
                Package = new RandomPackageSource();
                break;

            case PackageSourceTypes.RandomServer:
                Package = new RandomServerPackageSource();
                break;

            case PackageSourceTypes.Local:
                var packagePath = PlatformManager.Instance.SelectLocalPackage();
                if (packagePath != null)
                {
                    Package = new CustomPackageSource(packagePath);
                }
                break;

            case PackageSourceTypes.SIStorage:
                var contentBox = new ContentBox {
                    Data = StorageInfo, Title = Resources.SIStorage
                };
                StorageInfo.Init();
                Navigate?.Invoke(contentBox);
                break;

            case PackageSourceTypes.VK:
                try
                {
                    Process.Start(Resources.ThemesLink);
                }
                catch (Exception exc)
                {
                    PlatformManager.Instance.ShowMessage(string.Format(Resources.VKThemesError + "\r\n{1}", Resources.ThemesLink, exc.Message), MessageType.Error);
                }
                break;
            }
        }
Ejemplo n.º 11
0
 private void OnSignUp(object obj)
 {
     if (SignUpModel.Password == SignUpModel.ReenterPw)
     {
         if (CodeAnalysisServiceClient.SignUp(SignUpModel.UserName, SignUpModel.Password))
         {
             Navigate.Invoke(ViewPages.SignIn);
         }
         else
         {
             MessageBox.Show("Invalid Sign In");
         }
     }
     else
     {
         MessageBox.Show("Ensure Passwords are identical");
     }
 }
        private void Task_Navigate(object?sender, EventArgs e)
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            if (sender is not ResourceErrorTask task)
            {
                return;
            }

            var entry = task.Entry;

            if (entry == null)
            {
                return;
            }

            Navigate?.Invoke(entry);
        }
Ejemplo n.º 13
0
        private void Item_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            var acc = (GameAccount)sender;

            if (e.PropertyName == nameof(GameAccount.AccountType))
            {
                UpdatePlayer(acc);
            }
            else if (e.PropertyName == nameof(GameAccount.SelectedAccount))
            {
                var index = Players.IndexOf(acc);

                if (index > -1 && index < _model.Players.Length)
                {
                    _model.Players[index] = acc.SelectedAccount;
                }

                if (acc.SelectedAccount == _computerPlayers.Last())
                {
                    var account = new ComputerAccount()
                    {
                        CanBeDeleted = true
                    };

                    // Зададим ему рандомные характеристики
                    account.Randomize();

                    var newComputerAccount = new ComputerAccountViewModel(account, null);
                    newComputerAccount.Add += NewComputerAccount_Add;
                    var contentBox = new ContentBox {
                        Data = newComputerAccount, Title = Resources.NewPlayer, Cancel = _closeNewPlayer
                    };
                    Navigate?.Invoke(contentBox);
                }

                CheckUniqueAccounts();
            }
        }
Ejemplo n.º 14
0
 private void viewModel_Navigate(object sender, NavigateCodeEventArgs e)
 {
     Navigate?.Invoke(this, e);
     Hide();
 }
Ejemplo n.º 15
0
 void NavigateButton_Click(object sender, EventArgs e)
 {
     Navigate.Invoke(this, new EventArgs());
 }
Ejemplo n.º 16
0
 private void OnSignUp(object obj)
 {
     Navigate.Invoke(ViewPages.SignUp);
 }
Ejemplo n.º 17
0
 private void OnNavigate(object parameter)
 {
     Navigate?.Invoke(this, new EventArgs());
 }
Ejemplo n.º 18
0
 public static void NavigateTo(BaseViewModel viewModel)
 {
     Navigate.Invoke(null, new NavigationEventArgs(viewModel));
 }
Ejemplo n.º 19
0
 private void OnReturn(object obj)
 {
     Navigate.Invoke(ViewPages.ToolRun);
 }
Ejemplo n.º 20
0
 private void OnLogout(object obj)
 {
     Navigate.Invoke(ViewPages.SignIn);
 }
Ejemplo n.º 21
0
 private void OnToolTest(object obj)
 {
     Navigate.Invoke(ViewPages.ToolTest);
 }