Exemplo n.º 1
0
        private void btnDongY_Click(object sender, EventArgs e)
        {
            //validate view
            DataView view = dgrdDSNVTrgPhg.DataSource as DataView;

            if (view == null)
            {
                kq = YesNoCancel.Cancel;
                Close();
                return;
            }

            var checkedRowView = (from DataRow row in view.Table.Rows where row["check"] != DBNull.Value && (bool)row["check"] select row).ToList();

            if (!checkedRowView.Any())             // nếu ko check dấu nào thì đóng, chế độ cancel
            {
                kq = YesNoCancel.Cancel;
                Close();
                return;
            }

            //add các checkedRow, đóng form chế độ đồng ý
            mCheckedRow.AddRange(checkedRowView);
            kq = YesNoCancel.Yes;
            this.Close();
        }
Exemplo n.º 2
0
        private void exitBtn_Click(object sender, RoutedEventArgs e)
        {
            if (isChange())
            {
                YesNoCancel ync = new YesNoCancel("ต้องการบันทึกข้อมูลหรือไม่", "ยืนยันการออกจากการทำงาน");
                ync.ShowDialog();
                switch (ync.response)
                {
                case YesNoCancel.RESULT_YES:
                    if (!saveData())
                    {
                        return;
                    }
                    break;

                case YesNoCancel.RESULT_NO:
                    break;

                case YesNoCancel.RESULT_CANCEL:
                    return;

                default:
                    return;
                }
            }
            this.Close();
        }
Exemplo n.º 3
0
        private void DataFromDocument(XDocument xDoc)
        {
            string tilesetPath = xDoc.Root.Element("EditorConfig").Element("Tileset").Value;

            YesNoCancel ync = Global.ImageChecker(tilesetPath, out tilesetPath);

            if (ync == YesNoCancel.Cancel || ync == YesNoCancel.No)
            {
                return;
            }

            string[] mapSize  = xDoc.Root.Element("Config").Element("MapSize").Value.Split(',');
            Point2D  mapSizep = new Point2D(Convert.ToInt16(mapSize[0]), Convert.ToInt16(mapSize[1]));

            int tileSize = Convert.ToInt16(xDoc.Root.Element("Config").Element("TileSize").Value);

            List <string> layers = new List <string>();

            foreach (XElement xEl in xDoc.Root.Element("Config").Elements("Layers").Descendants())
            {
                layers.Add(xEl.Name.ToString());
            }

            MainWindow.Instance.NewMap(mapSizep, tilesetPath, layers, tileSize);

            foreach (XElement xEl in xDoc.Root.Element("Tiles").Elements("Tile"))
            {
                string[] source   = xEl.Element("Source").Value.Split(',');
                string[] location = xEl.Element("Location").Value.Split(',');

                Tile tile = new Tile
                {
                    TilesetLocation = new Point2D(Convert.ToInt16(source[0]), Convert.ToInt16(source[1])),
                    Location        = new Point2D(Convert.ToInt16(location[0]), Convert.ToInt16(location[1])),
                    Layer           = Convert.ToInt16(location[2])
                };

                MainWindow.Instance.AddTile(tile);
            }

            foreach (XElement xEl in xDoc.Root.Element("Entities").Elements("Entity"))
            {
                string[] location = xEl.Element("Location").Value.Split(',');
                string[] size     = xEl.Element("Size").Value.Split(',');

                Entity entity = new Entity
                {
                    Name       = xEl.Element("Name").Value,
                    Position   = new Point2D(Convert.ToInt16(location[0]), Convert.ToInt16(location[1])),
                    Size       = new Point2D(Convert.ToInt16(size[0]), Convert.ToInt16(size[1])),
                    CustomData = xEl.Element("CustomData").Value
                };

                Global.Entities.Add(entity);
            }

            Global.ToolType = ToolTypes.TilePlacer;

            Global.TileLayer = Convert.ToInt16(xDoc.Root.Element("EditorConfig").Element("LayerIndex").Value);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Displays a dialog that asks the user how to handle a situation where non-standard location linked files
        /// cannot be restored to their previous position.
        /// </summary>
        /// <param name="linkedFilesPathPersisted"></param>
        /// <param name="filesContainedInLinkdFilesFolder"></param>
        protected virtual void CouldNotRestoreLinkedFilesToOriginalLocation(string linkedFilesPathPersisted, Dictionary <string, DateTime> filesContainedInLinkdFilesFolder)
        {
            YesNoCancel userSelection = m_ui.CannotRestoreLinkedFilesToOriginalLocation();

            if (userSelection == YesNoCancel.OkYes)
            {
                m_sLinkDirChangedTo = FdoFileHelper.GetDefaultLinkedFilesDir(m_restoreSettings.ProjectPath);
                //Restore the files to the project folder.
                UncompressLinkedFiles(filesContainedInLinkdFilesFolder, m_sLinkDirChangedTo, linkedFilesPathPersisted);
            }
            else if (userSelection == YesNoCancel.OkNo)
            {
                //Do nothing. Do not restore any LinkedFiles.
            }
        }
Exemplo n.º 5
0
        private bool InternalClose(bool updateState)
        {
            bool result = true;

            if (IsModified)
            {
                YesNoCancel state = SaveDialog();

                if (state == YesNoCancel.Cancel)
                {
                    return(false);
                }

                if (state == YesNoCancel.Yes)
                {
                    if (CurrentLoadoutName != null)
                    {
                        result = InternalSave();
                    }
                    else
                    {
                        result = InternalSaveAs();
                    }
                }
            }

            if (result && updateState)
            {
                foreach (AbilityViewModel ability in rootViewModel.SelectedAbilities.Where(x => x.IsChecked))
                {
                    ability.IsChecked = false;
                }

                // Postponing rest of the IsModified flag to false to the next scheduler frame is
                // because of a change in the way ability/skill checkboxes are processed, for performance reasons.
                rootViewModel.Dispatcher.BeginInvoke((Action) delegate { IsModified = false; });

                CurrentLoadoutName = null;

                ConfigurationManager.Save(GlobalData.Instance.Configuration);
            }

            return(result);
        }
Exemplo n.º 6
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            int[] selectedRowHandle = gridView1.GetSelectedRows();
            if (selectedRowHandle.Count() > 1)
            {
                MessageBox.Show("chọn quá nhiều row");
                return;
            }

            dynamic objectCa = gridView1.GetRow(selectedRowHandle[0]);

            if (objectCa == null || objectCa.ca == null)
            {
                return;
            }
            selectedCa    = objectCa.ca;
            m_YesNoCancel = YesNoCancel.Yes;
            Close();
        }
Exemplo n.º 7
0
 public void Initialize()
 {
     this.builder.Clear();
     Input  = null;
     Answer = YesNoCancel.Cancel;
 }
Exemplo n.º 8
0
        private void Apply_Click(object sender, RoutedEventArgs e)
        {
            string tilesetPath = TilesetPath.Text;

            try
            {
                int tileSize = Convert.ToInt16(TileSize.Text);
                Global.Preferences.Write("TileSize", tileSize.ToString());
            }
            catch (Exception)
            {
                MessageBox.Show("Tile size must be an integer");
            }

            YesNoCancel ync = Global.ImageChecker(tilesetPath, out tilesetPath);

            if (ync == YesNoCancel.Cancel || ync == YesNoCancel.No)
            {
                return;
            }

            if (ForceNew || Global.State != States.MapOpen)
            {
                if (Global.State == States.MapOpen)
                {
                    Global.Command_Close();
                }
                MainWindow.Instance.NewMap(new Point2D(Convert.ToInt32(GridSize_X.Text), Convert.ToInt32(GridSize_Y.Text)), tilesetPath, new List <string>(Global.Preferences.Read("DefaultLayers").Split('|')), Convert.ToInt16(TileSize.Text));
            }
            else
            {
                List <Tile>   newTiles   = MainWindow.Instance.GetTileList();
                List <Entity> entityList = new List <Entity>();
                for (int i = 0; i < Global.Entities.Count; i++)
                {
                    entityList.Add(Global.Entities[i]);
                    Global.Entities[i].Destroy();
                }

                // Needs fixing
                MainWindow.Instance.CloseMap();
                MainWindow.Instance.NewMap(new Point2D(Convert.ToInt32(GridSize_X.Text), Convert.ToInt32(GridSize_Y.Text)), tilesetPath, new List <string>(Global.Preferences.Read("DefaultLayers").Split('|')), Convert.ToInt16(TileSize.Text));

                foreach (var tile in newTiles)
                {
                    tile.TilesetLocation = tile.TilesetLocation; // This refreshes the tileset
                }
                MainWindow.Instance.AddTiles(newTiles);

                foreach (Entity entity in entityList)
                {
                    entity.AddToGrid();
                    Global.Entities.Add(entity);
                }
            }

            Global.Preferences.Write("LastUsedTileset", tilesetPath);
            Global.Preferences.Write("LastUsedMapSize", GridSize_X.Text + "," + GridSize_Y.Text);

            this.Close();
        }
Exemplo n.º 9
0
 private void btnCancel_Click(object sender, EventArgs e)
 {
     this.m_YesNoCancel = YesNoCancel.Cancel;
     Close();
 }
Exemplo n.º 10
0
 public void Initialize()
 {
     this.builder.Clear();
     Input = null;
     Answer = YesNoCancel.Cancel;
 }
Exemplo n.º 11
0
 public void stageAnswer(YesNoCancel answer)
 {
     stagedAnswer = answer;
 }