コード例 #1
0
 private void btnSaveEdits_Click(object sender, EventArgs e)
 {
     NavigateEvent?.Invoke(sender,
                           new BoardNavigationEventArgs {
         EventType = NavigationEventType.Editor, Selected = _model.EditorState
     });
 }
コード例 #2
0
        private void lstAvailableMoves_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (!(lstAvailableMoves.SelectedItem is ProposedState ps))
            {
                return;
            }
            if (!(ps.Action is GameAction ga))
            {
                return;
            }
            moveListClicked = true;
            NavigateEvent?.Invoke(sender, new BoardNavigationEventArgs {
                EventType = NavigationEventType.ClearMove
            });
            if (ga is GameTargetAction gta)
            {
                InputEvent?.Invoke(sender, new BoardLocationEventArgs {
                    Location = ga.Location, MouseEvent = BoardMouseEventType.LeftDragStart
                });
                InputEvent?.Invoke(sender, new BoardLocationEventArgs {
                    Location = gta.Target, MouseEvent = BoardMouseEventType.LeftDragEnd
                });
            }
            else
            {
                InputEvent?.Invoke(sender, new BoardLocationEventArgs {
                    Location = ga.Location, MouseEvent = BoardMouseEventType.LeftClick
                });
            }

            _model.SelectedVariation = ga.Size;
            RedrawBoard();
            BoardEditorUpdate();
            moveListClicked = false;
        }
コード例 #3
0
        private void dgvGameState_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex < 0 || e.RowIndex >= dgvGameState.RowCount)
            {
                return;
            }
            if (e.ColumnIndex < 0 || e.ColumnIndex >= dgvGameState.Rows[e.RowIndex].Cells.Count)
            {
                return;
            }

            if (!(dgvGameState.Rows[e.RowIndex].Cells[e.ColumnIndex].Tag is State selectedState))
            {
                return;
            }

            if (selectedState.Equals(_model.CommittedState))
            {
                NavigateEvent?.Invoke(sender,
                                      new BoardNavigationEventArgs
                {
                    EventType = NavigationEventType.ClearMove,
                    Selected  = selectedState
                });
            }
            else
            {
                NavigateEvent?.Invoke(sender,
                                      new BoardNavigationEventArgs
                {
                    EventType = NavigationEventType.ShowHistory,
                    Selected  = selectedState
                });
            }
        }
コード例 #4
0
        public void Navigate(NavigateEvent navigator)
        {
            //if (navigator.Entity != null) SelectedAnalytic = (Domain.Analytic)navigator.Entity;
            //Name = SelectedAnalytic.Name;

            //if (!StepCache.ContainsKey(navigator.Section))
            //{
            //    switch (navigator.Section)// switch action bar for each step
            //    {
            //        case Domain.SectionType.PlanningAnalyticsMyAnalytics:
            //            break;
            //        case Domain.SectionType.PlanningAnalyticsIdentity:
            //            SelectedStepViewModel = new ViewModels.Analytic.IdentityViewModel(SelectedAnalytic);

            //            break;
            //        case Domain.SectionType.PlanningAnalyticsFilters:
            //            SelectedStepViewModel = new ViewModels.Analytic.FilterViewModel(SelectedAnalytic);
            //            break;
            //        //case SectionType.PlanningAnalyticsPriceLists:
            //        //    break;
            //        case Domain.SectionType.PlanningAnalyticsValueDrivers:
            //            SelectedStepViewModel = new ViewModels.Analytic.DriverViewModel(SelectedAnalytic);
            //            break;
            //        case Domain.SectionType.PlanningAnalyticsResults:
            //            SelectedStepViewModel = new ViewModels.Analytic.ResultsViewModel(SelectedAnalytic);
            //            break;
            //        default:
            //            break;
            //    }
            //    StepCache.Add(navigator.Section, _SelectedStepViewModel);
            //}
            //else // in cache
            //{
            //    switch (navigator.Section)
            //    {
            //        case Domain.SectionType.PlanningAnalyticsIdentity:
            //            SelectedStepViewModel = ((Analytic.IdentityViewModel)StepCache[navigator.Section]);
            //            //SelectedStepViewModel.Load(navigator.Entity);
            //            break;
            //        case Domain.SectionType.PlanningAnalyticsFilters:
            //            SelectedStepViewModel = ((Analytic.FilterViewModel)StepCache[navigator.Section]);
            //            break;
            //        case Domain.SectionType.PlanningAnalyticsValueDrivers:
            //            SelectedStepViewModel = ((Analytic.DriverViewModel)StepCache[navigator.Section]);
            //            break;
            //        case Domain.SectionType.PlanningAnalyticsResults:
            //            SelectedStepViewModel = ((Analytic.ResultsViewModel)StepCache[navigator.Section]);
            //            break;
            //        default:
            //            break;
            //    }
            //    SelectedStepViewModel.LoadAnalytic(SelectedAnalytic);

            //}
        }
コード例 #5
0
 //************
 // Events
 //------------
 void OnNavigateEvent(NavigateEvent e)
 {
     // If the link is not active, navigate to other links
     if (!Active)
     {
         Navigate(e.Direction);
     }
     // If it it's active, pass the navigation data to the subclass
     else
     {
         //Trace.Script("Active! Now redirecting to subclass... ", this);
         OnNavigate(e.Direction);
     }
 }
コード例 #6
0
 private void btnImportBoard_Click(object sender, EventArgs e)
 {
     try
     {
         NavigateEvent?.Invoke(sender,
                               new BoardNavigationEventArgs
         {
             EventType = NavigationEventType.LoadGame, Selected = StateSerializer.FromString(txtBoardData.Text.Trim())
         });
     }
     catch (Exception ex)
     {
         MessageBox.Show(this, ex.ToString(), "Unable to load board");
     }
 }
コード例 #7
0
        private void btnNewGame_Click(object sender, EventArgs e)
        {
            if (_model.EditMode)
            {
                NavigateEvent?.Invoke(sender, new BoardNavigationEventArgs {
                    EventType = NavigationEventType.ToggleEditMode
                });
            }

            NavigateEvent?.Invoke(sender,
                                  new BoardNavigationEventArgs {
                EventType = NavigationEventType.NewGame, Selected = StateManager.Create()
            });
            btnCommitMove.Select();
        }
コード例 #8
0
 public static void Publish(this NavigateEvent @this, string viewName, IDictionary <string, object> prms = null)
 {
     Navigate(@this, viewName, prms);
 }
コード例 #9
0
 public void SendNavigateMessage(NavigateMessageArgs args)
 {
     NavigateEvent?.Invoke(this, args);
 }
コード例 #10
0
 private void btnCommitMove_Click(object sender, EventArgs e)
 {
     NavigateEvent?.Invoke(sender, new BoardNavigationEventArgs {
         EventType = NavigationEventType.CommitMove
     });
 }
コード例 #11
0
 private void btnEditBoard_Click(object sender, EventArgs e)
 {
     NavigateEvent?.Invoke(sender, new BoardNavigationEventArgs {
         EventType = NavigationEventType.ToggleEditMode
     });
 }
コード例 #12
0
        public void Navigate(NavigateEvent navigator)
        {
            //if (navigator.Entity != null) SelectedPriceRoutine = (Domain.PriceRoutine)navigator.Entity;
            //Name = SelectedPriceRoutine.Name;

            //if (!StepCache.ContainsKey(navigator.Section))
            //{
            //    switch (navigator.Section)
            //    {
            //        //case SectionType.PlanningPricingMyPricing:
            //        //    break;
            //        case Domain.SectionType.PlanningPricingIdentity:
            //            SelectedStepViewModel = new Pricing.IdentityViewModel(SelectedPriceRoutine);
            //            break;
            //        case Domain.SectionType.PlanningPricingFilters:
            //            SelectedStepViewModel = new Pricing.FilterViewModel(SelectedPriceRoutine);
            //            break;
            //        case Domain.SectionType.PlanningPricingPriceLists:
            //            break;
            //        case Domain.SectionType.PlanningPricingRounding:
            //            break;
            //        case Domain.SectionType.PlanningPricingStrategy:
            //            break;
            //        case Domain.SectionType.PlanningPricingResults:
            //            break;
            //        case Domain.SectionType.PlanningPricingForecast:
            //            break;
            //        case Domain.SectionType.PlanningPricingApproval:
            //            break;
            //        default:
            //            break;
            //    }
            //    StepCache.Add(navigator.Section, _SelectedStepViewModel);
            //}
            //else //in cache
            //{
            //    switch (navigator.Section)
            //    {
            //        //case SectionType.PlanningPricingMyPricing:
            //        //    break;
            //        case Domain.SectionType.PlanningPricingIdentity:
            //            SelectedStepViewModel = ((Pricing.IdentityViewModel)StepCache[navigator.Section]);
            //            break;
            //        case Domain.SectionType.PlanningPricingFilters:
            //            SelectedStepViewModel = ((Pricing.FilterViewModel)StepCache[navigator.Section]);
            //            break;
            //        case Domain.SectionType.PlanningPricingPriceLists:
            //            break;
            //        case Domain.SectionType.PlanningPricingRounding:
            //            break;
            //        case Domain.SectionType.PlanningPricingStrategy:
            //            break;
            //        case Domain.SectionType.PlanningPricingResults:
            //            break;
            //        case Domain.SectionType.PlanningPricingForecast:
            //            break;
            //        case Domain.SectionType.PlanningPricingApproval:
            //            break;
            //        default:
            //            break;
            //    }
            //    SelectedStepViewModel.LoadPriceRoutine(SelectedPriceRoutine);
            //}
        }