Пример #1
0
        void populatePeopleScroll(int index)
        {
            var vm = ViewModel as MainViewModel;

            if (vm.UsersList != null)
            {
                StackPanel peoplepanel = new StackPanel()
                {
                    Orientation = Orientation.Vertical
                };
                for (int i = 0; i < vm.UsersList.Count; i++)
                {
                    var newinfo = new InfoControl()
                    {
                        Index          = i,
                        CanSelect      = false,
                        OnImage        = "ms-appx:///Resources/muro/greencircle.png",
                        OffImage       = "ms-appx:///Resources/muro/whitecircle.png",
                        SelectOnImage  = "ms-appx:///Resources/muro/greencircle.png",
                        SelectOffImage = "ms-appx:///Resources/muro/whitecircle.png",
                        IsSelected     = false,
                        ContentBlock   = vm.UsersList[i].user.name,
                        IsOn           = true,
                        InfoColor      = StaticStyles.DefaultColor
                    };
                    peoplepanel.Children.Add(newinfo);
                }
                _peoplescroll.Content = peoplepanel;
                PeopleRing.Visibility = Visibility.Collapsed;
            }
        }
Пример #2
0
 private void InitControls()
 {
     #region main_menu
     main_menu          = new Controls.MainMenu(OnMainMenuResultChanged);
     main_menu.Visible  = false;
     main_menu.Location = new Point(Size.Width / 2 - main_menu.Size.Width / 2,
                                    Size.Height / 2 - main_menu.Size.Height / 2);
     this.Controls.Add(main_menu);
     #endregion
     #region setting_control
     setting_control         = new SettingsControl(OnSettingsConrolResultChanged);
     setting_control.Visible = false;
     //setting_control.Dock = DockStyle.Fill;
     setting_control.Location = new Point(Size.Width / 2 - setting_control.Size.Width / 2,
                                          Size.Height / 2 - setting_control.Size.Height / 2);
     this.Controls.Add(setting_control);
     #endregion
     #region info_control
     info_control         = new InfoControl(OnInfoControlResultChanged);
     info_control.Visible = false;
     //info_control.Dock = DockStyle.Fill;
     info_control.Location = new Point(Size.Width / 2 - info_control.Size.Width / 2,
                                       Size.Height / 2 - info_control.Size.Height / 2);
     this.Controls.Add(info_control);
     #endregion
     #region pause_menu
     pause_menu         = new PauseMenu(OnPauseMenuResultChanged);
     pause_menu.Visible = false;
     //pause_menu.Dock = DockStyle.Fill;
     pause_menu.Location = new Point(Size.Width / 2 - pause_menu.Size.Width / 2,
                                     Size.Height / 2 - pause_menu.Size.Height / 2);
     this.Controls.Add(pause_menu);
     #endregion
 }
Пример #3
0
        /// <summary>
        /// Prevents a default instance of the <see cref="InfoController"/> class from being created.
        /// </summary>
        /// <exception cref="System.InvalidOperationException">InfoControl was null/not found</exception>
        private InfoController()
        {
            infoControl = MainForm.Instance.GetComponent("InfoControl") as InfoControl;
            Debug.Assert(infoControl != null, "InfoControl was null/not found");

            var htc  = infoControl.HistoryControl;
            var stc  = infoControl.ScenariosControl;
            var hstc = infoControl.HopsControl;
            var rtc  = infoControl.ResultsControl;

            Debug.Assert(htc != null, "HistoryTabControl was null/not found");
            Debug.Assert(stc != null, "ScenariosTabControl was null/not found");
            Debug.Assert(hstc != null, "HopsTabControl was null/not found");
            Debug.Assert(rtc != null, "ResultTabControl was null/not found");

            // History Control Eventhandler
            htc.HistoryRerunButtonClicked  += historyTabPage_HistoryRerunButtonClicked;
            htc.HistoryClearButtonClicked  += historyTabPage_HistoryClearButtonClicked;
            htc.HistoryDeleteButtonClicked += historyTabPage_HistoryDeleteButtonClicked;

            // Scenarios Control Eventhandler
            stc.StartScenarioButtonClicked += ScenarioTabPage_StartScenarioButtonClicked;

            // Hops Control (associated) Eventhandler
            hstc.PacketSelected += hopsTabPage_PacketSelected;
            infoControl.HopsTabPage_Selected   += hopsTabPage_Selected;
            infoControl.HopsTabPage_Deselected += hopsTabPage_Deselected;
            hstc.HopSelected += Hstc_HopSelected;

            // Result Control Eventhandler
            rtc.ClearButtonClicked += resultsTabPage_ClearButtonClicked;
        }
Пример #4
0
        private TextBlock AddComboBox(Grid parentGrid, DependencyProperty dependencyProperty, int initialItemIndex, string[] comboBoxItems, string tooltipText,
                                      double topMargin = 2,
                                      Func <string, object> resolveItemText      = null,
                                      Action <ComboBox, object> selectionChanged = null)
        {
            parentGrid.RowDefinitions.Add(new RowDefinition()
            {
                Height = new GridLength(1, GridUnitType.Auto)
            });
            int rowIndex = parentGrid.RowDefinitions.Count - 1;


            var textBlock = new TextBlock()
            {
                Text = dependencyProperty.Name + ':',
                VerticalAlignment = VerticalAlignment.Center,
                FontWeight        = FontWeights.Bold,
                Margin            = new Thickness(0, topMargin, 0, 2)
            };

            Grid.SetColumn(textBlock, 0);
            Grid.SetRow(textBlock, rowIndex);
            parentGrid.Children.Add(textBlock);


            var comboBox = new ComboBox()
            {
                Margin = new Thickness(5, topMargin, 10, 2)
            };

            SetupComboBox(TextBlockVisual1, dependencyProperty, comboBox, initialItemIndex, comboBoxItems, resolveItemText, selectionChanged);

            Grid.SetColumn(comboBox, 1);
            Grid.SetRow(comboBox, rowIndex);
            parentGrid.Children.Add(comboBox);


            if (!string.IsNullOrEmpty(tooltipText))
            {
                var infoControl = new InfoControl()
                {
                    InfoText          = tooltipText,
                    InfoWidth         = 400,
                    VerticalAlignment = VerticalAlignment.Center,
                    Margin            = new Thickness(0, topMargin, 0, 2)
                };

                Grid.SetColumn(infoControl, 2);
                Grid.SetRow(infoControl, rowIndex);
                parentGrid.Children.Add(infoControl);
            }

            return(textBlock);
        }
Пример #5
0
        public void Init(Desire d)
        {
            switch (d)
            {
            case Desire.Add:
                Content = new AddControl();
                break;

            case Desire.Info:
                Content = new InfoControl();
                break;
            }
        }
        public LogicMediator(Stock[] stocks, DataGridControl dataGridControl,
                             InfoControl infoControl, MyChartControl chartControl)
        {
            this.dataGridControl = dataGridControl ?? throw new ArgumentNullException(nameof(dataGridControl));
            this.infoControl     = infoControl ?? throw new ArgumentNullException(nameof(infoControl));
            this.chartControl    = chartControl ?? throw new ArgumentNullException(nameof(chartControl));

            Pairs = new ObservableCollection <ExtFinancialPair>(
                FinancialPair.CreateMany <ExtFinancialPair>(
                    stocks ?? throw new ArgumentNullException(nameof(stocks))
                    ));

            dataGridControl.InitDataGridControl(Pairs, UpdateInfoAndCharts);
            infoControl.InitInfoControl(Calculate, UpdateInfoAndCharts);
        }
Пример #7
0
 private void buttonInfo_Click(object sender, EventArgs e)
 {
     try
     {
         InfoControl infoBox = new InfoControl("OfficeCompatibility.Info" + _currentLanguageID.ToString() + ".rtf", true);
         this.Controls.Add(infoBox);
         infoBox.BringToFront();
         infoBox.Show();
     }
     catch (Exception exception)
     {
         ErrorForm errorForm = new ErrorForm(exception, ErrorCategory.NonCritical, _currentLanguageID);
         errorForm.ShowDialog(this);
     }
 }
 private void buttonInfo_Click(object sender, EventArgs e)
 {
     try
     {
         Stream      stream  = InnerInstance.GetHelpText(InnerInstance.Host.CurrentLanguageID);
         InfoControl infoBox = new InfoControl(stream);
         this.Controls.Add(infoBox);
         infoBox.BringToFront();
         infoBox.Show();
         stream.Close();
         stream.Dispose();
     }
     catch (Exception exception)
     {
         Forms.ErrorForm.ShowError(this, exception, ErrorCategory.NonCritical, InnerInstance.Host.CurrentLanguageID);
     }
 }
Пример #9
0
        void populateCircleScroll(int index)
        {
            var vm = ViewModel as MainViewModel;

            _currentCircles = new List <InfoControl>();
            if (vm.CirclesList != null)
            {
                CirclesRing.Visibility = Visibility.Collapsed;
                StackPanel circlepanel = new StackPanel()
                {
                    Orientation = Orientation.Vertical
                };
                for (int i = index; i < vm.CirclesList.Count; i++)
                {
                    var newcircle = new InfoControl()
                    {
                        Index          = i,
                        CanSelect      = true,
                        OnImage        = "ms-appx:///Resources/muro/greenpop.png",
                        OffImage       = "ms-appx:///Resources/muro/graypop.png",
                        SelectOnImage  = "ms-appx:///Resources/muro/greenpop.png",
                        SelectOffImage = "ms-appx:///Resources/muro/whitepop.png",
                        IsSelected     = false,
                        ContentBlock   = vm.CirclesList[i].name,
                        IsOn           = true,
                        InfoColor      = StaticStyles.DefaultColor
                    };
                    if (i == 0)
                    {
                        newcircle.IsSelected = true;
                        CircleNameText.Text  = vm.CirclesList[i].name;
                        _isCircleSelected    = true;
                    }
                    circlepanel.Children.Add(newcircle);
                    newcircle.Tapped += newcircle_Tapped;
                    _currentCircles.Add(newcircle);
                }
                _circlescroll.Content = circlepanel;

                UnidadNumber.Text = "?";
                if (vm.PendingQuizzesList != null)
                {
                    CursoNumber.Text = "" + vm.PendingQuizzesList.Count;
                }
            }
        }
Пример #10
0
    private async void OperationState_StateChanged(object sender, OperationStateChangedEventArgs e)
    {
        if (e.State == TestOperationStates.TestExecutionStarted)
        {
            InfoControl.ResetBackgroundColor();
        }
        else if (e.State == TestOperationStates.TestExecutionFinished)
        {
            IEnumerable <ITest> tests;
            try
            {
                IDisposableQuery <ITest> obsoleteTests = await TestsService.GetTestsAsync();

                tests = obsoleteTests.AsEnumerable();
            }
            catch
            {
                tests = await TestsService.GetTestsAsEnumerableAsync();
            }
            InfoControl.UpdateWithTestResult(tests);
        }
    }
 private void buttonInfo_Click(object sender, EventArgs e)
 {
     try
     {
         InfoControl infoBox = new InfoControl("ApplicationObserver.Info" + _currentLanguageID.ToString() + ".rtf", true);
         this.Controls.Add(infoBox);
         infoBox.BringToFront();
         infoBox.Show();
     }
     catch (Exception exception)
     {
         ErrorForm errorForm = new ErrorForm(exception, ErrorCategory.NonCritical, _currentLanguageID);
         errorForm.ShowDialog(this);
     }
 }
Пример #12
0
        public MainWindow()
        {
            Stopwatch stopWatch = new Stopwatch();

            stopWatch.Start();

            InitializeComponent();

            string locationString = System.IO.Path.GetFullPath(System.IO.Path.Combine(@AppDomain.CurrentDomain.BaseDirectory, @"..\\..\\")) + "GameData\\TestMap.txt";

            Grid grid = new Grid();

            grid.RowDefinitions.Add(new RowDefinition());
            grid.ColumnDefinitions.Add(new ColumnDefinition());
            grid.ColumnDefinitions.Add(new ColumnDefinition());
            grid.ColumnDefinitions.Add(new ColumnDefinition());

            Grid leftGrid = new Grid();

            leftGrid.RowDefinitions.Add(new RowDefinition());
            leftGrid.RowDefinitions.Add(new RowDefinition());
            leftGrid.RowDefinitions.Add(new RowDefinition());
            leftGrid.ColumnDefinitions.Add(new ColumnDefinition());

            Grid rightGrid = new Grid();

            rightGrid.RowDefinitions.Add(new RowDefinition());
            rightGrid.RowDefinitions.Add(new RowDefinition());
            rightGrid.ColumnDefinitions.Add(new ColumnDefinition());

            Grid.SetRow(leftGrid, 0);
            Grid.SetColumn(leftGrid, 0);
            leftGrid.SetValue(Grid.ColumnSpanProperty, 2);

            Grid.SetRow(rightGrid, 0);
            Grid.SetColumn(rightGrid, 2);

            grid.Children.Add(rightGrid);
            grid.Children.Add(leftGrid);

            InfoControl info = new InfoControl();

            TabControl tabCtrl = info.TabCtrl;

            Grid.SetRow(tabCtrl, 1);
            Grid.SetColumn(tabCtrl, 0);

            rightGrid.Children.Add(tabCtrl);

            this.output = info.Output;
            Player player = new Player("USA", 20, 20, info.OrderOfBattle);

            player.AddUnit(new SuperUnit("2nd Infantry Division"));

            MapFrame map = new MapFrame(locationString, output);

            Grid.SetRow(map, 1);
            Grid.SetColumn(map, 0);
            map.SetValue(Grid.RowSpanProperty, 2);

            leftGrid.Children.Add(map);

            this.Content = grid;

            MapControlFrame mapControl = new MapControlFrame(map, output);

            Grid.SetRow(mapControl, 0);
            Grid.SetColumn(mapControl, 0);

            leftGrid.Children.Add(mapControl);

            stopWatch.Stop();

            long ts = stopWatch.ElapsedMilliseconds;

            output.postMessage("Application started.");
            output.postMessage(locationString);
            output.postMessage(map.ActualWidth.ToString());
            output.postMessage(map.ActualHeight.ToString());
            output.postMessage("Took " + ts.ToString() + " MS to start.");
        }