Example #1
0
        private void ShowPrompt()
        {
            logger.Debug("显示组件提示屏命令");

            string filePath = helper.GetSubassembly(project, this.SelectedItem.Name.PropertyValue, this.SelectedItem.RowIndex, this.productHandle);

            //如果当前任务里没有这个组件的cutx文件,则需要从组件库中查找并拷贝
            if (!File.Exists(filePath))
            {
                MessageBox.Show("未找到对应的组件文件!");
                return;
            }

            SubPromptWindow spw = new SubPromptWindow(logger, app, filePath, book.WorkbookSet, this.SelectedItem);

            if (spw.ShowDialog() == true)//对于组件修改来说,要进行保存
            {
                this.SelectedItem.Width.PropertyValue  = spw.Manager.Width.ToString();
                this.SelectedItem.Height.PropertyValue = spw.Manager.Height.ToString();
                this.SelectedItem.Depth.PropertyValue  = spw.Manager.Depth.ToString();

                book.WorkbookSet.Workbooks["S"].SaveAs(filePath, FileFormat.OpenXMLWorkbook);
                book.WorkbookSet.Workbooks[filePath.Substring(filePath.LastIndexOf("\\") + 1)].Close();//关掉,释放之
            }
            else
            {
                book.WorkbookSet.Workbooks["S"].Close();//关掉,释放之
            }
        }
        private void ShowPrompt()
        {
            logger.Debug("显示组件提示屏命令");

            string filePath = helper.GetSubassembly(project, this.SelectedItem.Name.PropertyValue, this.SelectedItem.RowIndex, this.productHandle);

            //如果当前任务里没有这个组件的cutx文件,则需要从组件库中查找并拷贝
            if (!File.Exists(filePath))
            {
                MessageBox.Show("未找到对应的组件文件!");
                return;
            }

            SubPromptWindow spw = new SubPromptWindow(logger, app, filePath, book.WorkbookSet, this.SelectedItem);
            if (spw.ShowDialog() == true)//对于组件修改来说,要进行保存
            {
                this.SelectedItem.Width.PropertyValue = spw.Manager.Width.ToString();
                this.SelectedItem.Height.PropertyValue = spw.Manager.Height.ToString();
                this.SelectedItem.Depth.PropertyValue = spw.Manager.Depth.ToString();

                book.WorkbookSet.Workbooks["S"].SaveAs(filePath, FileFormat.OpenXMLWorkbook);
                book.WorkbookSet.Workbooks[filePath.Substring(filePath.LastIndexOf("\\") + 1)].Close();//关掉,释放之
            }
            else
            {
                book.WorkbookSet.Workbooks["S"].Close();//关掉,释放之
            }
        }