private void ExcuteImport(object obj)
        {
            if (!this.CurrentFilePath.Length.Equals(0) && MessageBox.Show("변경한 내용은 저장되지 않습니다. 그래도 진행하시겠습니까?", "경고",
                                                                          MessageBoxButton.YesNo, MessageBoxImage.Warning).Equals(MessageBoxResult.No))
            {
                return;
            }
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Filter = "dat Files (*.dat)|*.dat|All Files (*.*)|*.*";

            if (openFileDialog.ShowDialog().Equals(true))
            {
                var data = XmlManager.Deserialize(openFileDialog.FileName, this.Students.GetType());

                if (data == null)
                {
                    MessageBox.Show("학생정보 파일이 아닙니다.", "에러", MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }

                this.setStudents(data as ObservableCollection <Student>);

                this.CurrentFilePath = openFileDialog.FileName;

                ConfigManager.WriteProfileString(EConfigSection.Students.ToString(),
                                                 EConfigKey.FilePath.ToString(), this.CurrentFilePath);
            }
        }
Beispiel #2
0
        private void ExecuteImport(object o)
        {
            if (!this.CurrentFilePath.Length.Equals(0) && MessageBox.Show("변경한 내용은 저장되지 않습니다. 그래도 진행하시겠습니까?", "경고",
                                                                          MessageBoxButton.YesNo, MessageBoxImage.Warning).Equals(MessageBoxResult.No))
            {
                return;
            }

            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Filter = "dat Files (*.dat)|*.dat|All Files (*.*)|*.*";

            if (openFileDialog.ShowDialog().Equals(true))
            {
                this.CurrentFilePath = openFileDialog.FileName;

                var data = XmlManager.Deserialize(this.CurrentFilePath, typeof(List <AttendanceRecord>));

                if (data == null)
                {
                    MessageBox.Show("출결정보 파일이 아닙니다.", "에러", MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }

                this.attendanceRecords = ((List <AttendanceRecord>)data).ConvertAll(x => (ICalendarData)x);

                MyCalendar calendar = o as MyCalendar;
                calendar.BuildCalendarOutCaller(this.attendanceRecords);

                ConfigManager.WriteProfileString(EConfigSection.Attendance.ToString(), EConfigKey.FilePath.ToString(),
                                                 this.CurrentFilePath);
            }
        }
Beispiel #3
0
        public void DeserializeTest()
        {
            XmlManager target = new XmlManager();
            string     path   = @"E:\work\eq\server\tools\script_editor\TestCommon\bin\Debug\map\common_scene.xml";
            SceneInfo  actual;

            actual = target.Deserialize <SceneInfo>(path);
            Assert.AreEqual(1, actual.common_scene[0].id);
        }
 private void ExcuteInitial(object obj)
 {
     if (this.CurrentFilePath.Length.Equals(0))
     {
         MessageBox.Show("작업중인 파일이 없습니다.", "실패", MessageBoxButton.OK, MessageBoxImage.Error);
         return;
     }
     if (MessageBox.Show("변경한 내용은 저장되지 않습니다. 그래도 진행하시겠습니까?", "경고",
                         MessageBoxButton.YesNo, MessageBoxImage.Warning).Equals(MessageBoxResult.Yes))
     {
         this.setStudents(XmlManager.Deserialize(this.CurrentFilePath, this.Students.GetType()) as ObservableCollection <Student>);
     }
 }
        public StudentManageVM()
        {
            Import   = new RelayCommand(ExcuteImport);
            AllClear = new RelayCommand(ExcuteAllClear);
            Export   = new RelayCommand(ExcuteExport);
            Save     = new RelayCommand(ExcuteSave);
            Initial  = new RelayCommand(ExcuteInitial);

            this.CurrentFilePath = ConfigManager.ReadProfileString(EConfigSection.Students.ToString(),
                                                                   EConfigKey.FilePath.ToString(), this.CurrentFilePath);
            if (this.CurrentFilePath != null && !this.CurrentFilePath.Equals(string.Empty))
            {
                var a = XmlManager.Deserialize(this.CurrentFilePath, this.Students.GetType()) as ObservableCollection <Student>;

                this.setStudents(a);
            }
        }
Beispiel #6
0
        private void ExecuteInit(object o)
        {
            if (this.CurrentFilePath.Length.Equals(0))
            {
                MessageBox.Show("작업중인 파일이 없습니다.", "실패", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            if (MessageBox.Show("변경한 내용은 저장되지 않습니다. 그래도 진행하시겠습니까?", "경고",
                                MessageBoxButton.YesNo, MessageBoxImage.Warning).Equals(MessageBoxResult.Yes))
            {
                this.attendanceRecords = ((List <AttendanceRecord>)XmlManager.Deserialize(this.CurrentFilePath, typeof(List <AttendanceRecord>)))
                                         .ConvertAll(x => (ICalendarData)x);

                MyCalendar calendar = o as MyCalendar;
                calendar.BuildCalendarOutCaller(this.attendanceRecords);
            }
        }
Beispiel #7
0
        public AttendanceMainVM(MyCalendar myCalendar)
        {
            CalendarDayClickedCommand = new RelayCommand(OnCalendarDayClicked);
            CalendarDayModifyCommand  = new RelayCommand(OnCalendarDayModify);
            CalendarDayDeleteCommand  = new RelayCommand(OnCalendarDayDelete);
            SaveCommand                 = new RelayCommand(ExecuteSave);
            ImportCommand               = new RelayCommand(ExecuteImport);
            ExportCommand               = new RelayCommand(ExecuteExport);
            InitCommand                 = new RelayCommand(ExecuteInit);
            AllClearCommand             = new RelayCommand(ExecuteAllClear);
            ClearConditionCommand       = new RelayCommand(ExecuteClearCondition);
            AddConditionCommand         = new RelayCommand(ExecuteAddCondition);
            ClearResultConditionCommand = new RelayCommand(ExecuteClearResultCondition);

            string tmpStudentsPath = string.Empty;

            tmpStudentsPath = ConfigManager.ReadProfileString(EConfigSection.Students.ToString(), EConfigKey.FilePath.ToString(), tmpStudentsPath);
            if (tmpStudentsPath != null && !tmpStudentsPath.Equals(string.Empty))
            {
                this.Students.Add(new Student(string.Empty));
                foreach (var item in XmlManager.Deserialize(tmpStudentsPath, this.Students.GetType()) as List <Student> )
                {
                    this.Students.Add(item);
                }
            }
            else
            {
                MessageBox.Show("학생 정보가 없습니다. 설정을 먼저 해주세요.");
                this.IsVisibility = Visibility.Collapsed;
                this.Dispose();
                var a = ViewManager.GetValue(typeof(AttendanceMainV), false);
                IsGoodInit = false;
                return;
            }

            this.CurrentFilePath = ConfigManager.ReadProfileString(EConfigSection.Attendance.ToString(),
                                                                   EConfigKey.FilePath.ToString(), this.CurrentFilePath);
            if (!this.CurrentFilePath.Equals(string.Empty))
            {
                this.attendanceRecords = ((List <AttendanceRecord>)XmlManager.Deserialize(this.CurrentFilePath, typeof(List <AttendanceRecord>))).
                                         ConvertAll(x => (ICalendarData)x);
                myCalendar.BuildCalendarOutCaller(this.attendanceRecords);
            }
            IsGoodInit = true;
        }
Beispiel #8
0
    // Use this for initialization when manager is enabled with "setActive"
    void OnEnable()
    {
        Debug.Log("OnEnabled BattleManager");

        // Prevent to init on very first start of the game
        if (GameManager.instance != null && GameManager.instance.isBattle)
        {
            WordsRepository = XmlManager.Deserialize <WordsRepository>();
            WordLevel wordLevel = EmotionMenager.GetInstance().WordLevelDifficulty();
            ActiveWord = new WordToType(WordsRepository.GetRandomWord(wordLevel), WordSpawner.SpawnWord());

            // get random enemy from prefabs
            Debug.Log("Init enemy:");
            EnemyType enemyType = getEnemyType();
            Debug.Log(enemyType);
            if (enemyType.Equals(EnemyType.Wolf))
            {
                Debug.Log("Loading Wolf.");
                enemy = Instantiate(Resources.Load("Prefabs/WolfBattle", typeof(GameObject)), enemyPosition.position, Quaternion.identity) as GameObject;
            }
            else if (enemyType.Equals(EnemyType.Zombie))
            {
                Debug.Log("Loading Zombie.");
                enemy = Instantiate(Resources.Load("Prefabs/Zombie1Battle", typeof(GameObject)), enemyPosition.position, Quaternion.identity) as GameObject;
            }
            Debug.Log(enemy);
            // enemy.transform.parent = enemyPosition;
            //set up player&enemy health text
            Debug.Log("Player health: ");
            Debug.Log(playerInBattle.GetComponent <PlayerInBattle>().health);
            Debug.Log("Enemy health: ");
            Debug.Log(enemy.GetComponent <EnemyInBattle>().health);
            maxEnemyHealth    = enemy.GetComponent <EnemyInBattle>().health;
            playerHealth.text = playerInBattle.GetComponent <PlayerInBattle>().health + "/" + Player.maxHealth;
            enemyHealth.text  = enemy.GetComponent <EnemyInBattle>().health + "/" + enemy.GetComponent <EnemyInBattle>().health;
            headline.text     = "Fight!";
        }
    }