예제 #1
0
 //on click handler for "show tile browser" button
 private void ShowTileBrowser(object sender, RoutedEventArgs e)
 {
     if (model.AllLoadedShapes.Count != 0)
     {
         TileBrowser TB = new TileBrowser(model.AllLoadedShapes);
         if (TB.ShowDialog() == true)
         {
             controller.ApplyShapes(TB.TileControls);
         }
     }
     else
     {
         MessageBox.Show("No file has been loaded");
     }
 }
예제 #2
0
        /// <summary>
        ///On click handler for "load file" button that asks controller to load from selected file.
        ///Creates and opens TileBrowser
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void LoadFile(object sender, RoutedEventArgs e)
        {
            OpenFileDialog theDialog = new OpenFileDialog();

            theDialog.Title = "Open file";
            if (theDialog.ShowDialog() == true)
            {
                //ask controller to load selected file
                bool loaded = this.controller.LoadFromFile(theDialog.FileName);

                if (loaded == false)
                {
                    MessageBox.Show("Error occured while loading the selected file.");
                }
                else
                {
                    TileBrowser TB = new TileBrowser(model.AllLoadedShapes);
                    if (TB.ShowDialog() == true)
                    {
                        controller.ApplyShapes(TB.TileControls);
                    }
                }
            }
        }