예제 #1
0
        private void NewProjectButton_Click(object sender, RoutedEventArgs e)
        {
            ClearErrorMessage();

            // projectName:         Remington Apartment
            string projectName = newProjectNameTextBox.Text;
            // saveDirectoryPrefix: C:\Users\JZhang\Desktop\表格\Remington Apartment
            // full file path:      C:\Users\JZhang\Desktop\表格\Remington Apartment-xxxx表.xlsx
            string saveDirectoryPrefix = AppConfigReadingService.GetConfigSetting("formSaveDirectory") + "\\" + projectName;

            if (projectName == string.Empty || projectName == null)
            {
                newProjectErrMsgTextBlock.Visibility = Visibility.Visible;
                newProjectErrMsgTextBlock.Text       = "工程名不能为空";
            }
            else if (IOService.FileAlreadyExists(saveDirectoryPrefix + "-输入校对表" + AppConfigReadingService.GetSpreadSheetExtention()))
            {
                newProjectErrMsgTextBlock.Visibility = Visibility.Visible;
                newProjectErrMsgTextBlock.Text       = "工程名已存在";
            }
            else
            {
                List <InputItem> inputItems = new List <InputItem>();

                ItemInputPage itemInputPage = new ItemInputPage(inputItems, saveDirectoryPrefix);
                this.NavigationService.Navigate(itemInputPage);
            }
        }