Esempio n. 1
0
        private static void Window_OkButtonClicking(object sender, RoutedEventArgs e)
        {
            GeneralWindow window = (GeneralWindow)sender;
            CreateFeatureLayerUserControl userControl = (CreateFeatureLayerUserControl)window.Tag;
            string message = userControl.InvalidMessage;

            if (!string.IsNullOrEmpty(message))
            {
                MessageBox.Show(message, "Warning", MessageBoxButton.OK, MessageBoxImage.Warning);
                e.Handled = true;
            }
            ConfigureFeatureLayerParameters parameters = userControl.GetFeatureLayerInfo();

            if (Directory.Exists(parameters.LayerUri.LocalPath))
            {
                string           name         = Path.GetFileName(parameters.LayerUri.LocalPath);
                string           existMessage = string.Format(CultureInfo.InvariantCulture, "The destination already has a file named {0}, do you want to replace the file in destination?", name);
                MessageBoxResult result       = MessageBox.Show(existMessage, "Warning", MessageBoxButton.YesNo, MessageBoxImage.Warning);
                if (result == MessageBoxResult.No)
                {
                    e.Handled = true;
                }
                else
                {
                    try
                    {
                        Directory.Delete(parameters.LayerUri.LocalPath, true);
                    }
                    catch (Exception ex)
                    {
                        GisEditor.LoggerManager.Log(LoggerLevel.Debug, ex.Message, new ExceptionInfo(ex));
                    }
                }
            }
        }
Esempio n. 2
0
        public void SetWindow(GeneralWindow window)
        {
            //window settings
            window.WindowStyle   = WindowStyle.None;
            window.SizeToContent = SizeToContent.WidthAndHeight;

            window.Background = Brushes.Black;
            window.Foreground = Brushes.White;

            //main stack panel
            StackPanel stack = new StackPanel();

            stack.Orientation = Orientation.Horizontal;
            window.Content    = stack;

            //insert tetris play area in grid
            _tetrisGrid = new TetrisFE(new Size(16, 8), new ShapesGeneratorWithPrediction(3), TetrisTimers.Basic);
            stack.Children.Add(_tetrisGrid);
            _tetrisGrid.Play();

            //insert preditction panel and score panel
            stack.Children.Add(new PredictionFE(_tetrisGrid));
            stack.Children.Add(new ScoreHistoryFe(new ScoreCounter(_tetrisGrid)));

            //key control
            _keyControl = KeyLayouts.SinglePlayerLayout;
        }
Esempio n. 3
0
        public void SetWindow(GeneralWindow window)
        {
            var pickLvl = new PickLvlFE();

            window.Content = pickLvl;
            pickLvl.AddLvlType(new LvlItem(new SinglePlayerNoSpeeding(), "Single Player"));
            pickLvl.AddLvlType(new LvlItem(new MultiPlayer(), "Multiplayer"));
        }
Esempio n. 4
0
        public void SetWindow(GeneralWindow window)
        {
            //window settings
            window.WindowStyle   = WindowStyle.None;
            window.SizeToContent = SizeToContent.WidthAndHeight;

            window.Background = Brushes.Black;
            window.Foreground = Brushes.White;

            //main stack panel


            //Shared shape generator for both players
            var shapeGenerator = new ShapesGeneratorWithPrediction(3);

            //Creating GameArea for both players
            _tetrisFirstPlayer  = new TetrisFE(new Size(16, 8), shapeGenerator, TetrisTimers.Basic);
            _tetrisSecondPlayer = new TetrisFE(new Size(16, 8), shapeGenerator, TetrisTimers.Basic);

            //creating score counter for both players
            var scoreFirstPlayer  = new ScoreFE(new ScoreCounter(_tetrisFirstPlayer));
            var scoreSecondPlayer = new ScoreFE(new ScoreCounter(_tetrisSecondPlayer));

            //arange screen


            //create stack panel for first player
            StackPanel firstPlayerStack = new StackPanel();

            firstPlayerStack.Children.Add(scoreFirstPlayer);
            firstPlayerStack.Children.Add(_tetrisFirstPlayer);

            //create stack panel for second player
            StackPanel secondPlayerStack = new StackPanel();

            secondPlayerStack.Children.Add(scoreSecondPlayer);
            secondPlayerStack.Children.Add(_tetrisSecondPlayer);

            //add all to main stack panel
            StackPanel mainStack = new StackPanel();

            mainStack.Orientation = Orientation.Horizontal;
            window.Content        = mainStack;

            mainStack.Children.Add(firstPlayerStack);
            mainStack.Children.Add(new PredictionFE(shapeGenerator));
            mainStack.Children.Add(secondPlayerStack);

            //creating keycontrol for both players TODO make user settings for this
            _keysFirstPlayer  = KeyLayouts.LeftSideOfKeyboardLayout;
            _keysSecondPlayer = KeyLayouts.NumPadArowsLayout;

            //let the game begin
            _tetrisSecondPlayer.Play();
            _tetrisFirstPlayer.Play();
        }
        private static void OKButtonClicking(object sender, RoutedEventArgs e)
        {
            GeneralWindow window = (GeneralWindow)sender;
            CreateFeatureLayerUserControl userControl = (CreateFeatureLayerUserControl)window.Tag;
            string message = userControl.InvalidMessage;

            if (!string.IsNullOrEmpty(message))
            {
                MessageBox.Show(message, "Warning", MessageBoxButton.OK, MessageBoxImage.Warning);
                e.Handled = true;
            }
        }
Esempio n. 6
0
        private void BtnPrint_Click(object sender, RoutedEventArgs e)
        {
            FormDocument();

            document.Application.Dialogs[Microsoft.Office.Interop.Word.WdWordDialog.wdDialogFilePrint].Show();
            document.Application.Quit();
            document = null;

            // даёт доступ к элементам окна StartWindow
            GeneralWindow startWindow = (GeneralWindow)Application.Current.MainWindow;

            startWindow.GeneralWindow1.WindowState = WindowState.Minimized;
        }
        protected override ConfigureFeatureLayerParameters GetConfigureFeatureLayerParametersCore(FeatureLayer featureLayer)
        {
            CreateFeatureLayerUserControl userControl = new ConfigTinyGeoFileUserControl(featureLayer);
            GeneralWindow window = new GeneralWindow();

            window.Tag = userControl;
            window.OkButtonClicking     += OKButtonClicking;
            window.Title                 = GisEditor.LanguageManager.GetStringResource("TinyGeoWindowTitle");
            window.Owner                 = Application.Current.MainWindow;
            window.HelpContainer.Content = HelpResourceHelper.GetHelpButton("CreateNewShapefileHelp", HelpButtonMode.NormalButton);
            window.WindowStartupLocation = WindowStartupLocation.CenterOwner;
            window.ResizeMode            = ResizeMode.NoResize;
            window.SizeToContent         = SizeToContent.WidthAndHeight;
            window.ContentUI.Content     = userControl;

            ConfigureFeatureLayerParameters parameters = null;

            if (window.ShowDialog().GetValueOrDefault())
            {
                parameters = userControl.GetFeatureLayerInfo();
            }
            return(parameters);
        }
        protected override ConfigureFeatureLayerParameters GetConfigureFeatureLayerParametersCore(FeatureLayer featureLayer)
        {
            ConfigCsvFileUserControl userControl = new ConfigCsvFileUserControl(featureLayer);
            GeneralWindow            window      = new GeneralWindow();

            window.Tag = userControl;
            window.OkButtonClicking     += Window_OkButtonClicking;
            window.Title                 = GisEditor.LanguageManager.GetStringResource("CSVLayerWindowTitle");
            window.Owner                 = Application.Current.MainWindow;
            window.HelpContainer.Content = HelpResourceHelper.GetHelpButton("CreateNewShapefileHelp", HelpButtonMode.NormalButton);
            window.WindowStartupLocation = WindowStartupLocation.CenterOwner;
            window.ResizeMode            = ResizeMode.NoResize;
            window.SizeToContent         = SizeToContent.WidthAndHeight;
            window.ContentUI.Content     = userControl;

            ConfigureFeatureLayerParameters parameters = null;

            if (window.ShowDialog().GetValueOrDefault())
            {
                parameters = userControl.GetFeatureLayerInfo();
                parameters.CustomData["Delimiter"]   = userControl.ViewModel.Delimiter;
                parameters.CustomData["MappingType"] = userControl.ViewModel.MappingType;

                parameters.CustomData["X"]   = GetSpecificColumnName(userControl.ViewModel.CsvColumns, CsvColumnType.Longitude);
                parameters.CustomData["Y"]   = GetSpecificColumnName(userControl.ViewModel.CsvColumns, CsvColumnType.Latitude);
                parameters.CustomData["WKT"] = GetSpecificColumnName(userControl.ViewModel.CsvColumns, CsvColumnType.WKT);

                CsvFeatureLayer csvFeatureLayer = featureLayer as CsvFeatureLayer;
                if (csvFeatureLayer != null)
                {
                    csvFeatureLayer.XColumnName             = parameters.CustomData["X"].ToString();
                    csvFeatureLayer.YColumnName             = parameters.CustomData["Y"].ToString();
                    csvFeatureLayer.WellKnownTextColumnName = parameters.CustomData["WKT"].ToString();
                }
            }
            return(parameters);
        }