Пример #1
0
        private void buttonWith_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                DataGridRow row = DataGridUtils.FindVisualParent <DataGridRow>(e.OriginalSource as UIElement);
                if (null != row)
                {
                    InputModel model = row.Item as InputModel;
                    if (null != model)
                    {
                        OpenFileDialog openDialog = new OpenFileDialog();
                        openDialog.Title       = "Open a Model to Update with";
                        openDialog.Filter      = "Model (*.ifc, *.zip, *.dwg, *.ifczip)|*.ifc;*.zip;*.dwg;*.ifczip";
                        openDialog.Multiselect = false;
                        if (openDialog.ShowDialog() == true)
                        {
                            string fileName = openDialog.FileName;

                            int taskIndex = dataGridTasks.SelectedIndex;
                            int fileIndex = processUnits[taskIndex].Models.IndexOf(model);

                            processUnits[taskIndex].Models[fileIndex].IsUpdate = true;
                            processUnits[taskIndex].Models[fileIndex].With     = fileName;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                string message = ex.Message;
            }
        }
        private void buttonExe_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                DataGridRow row = DataGridUtils.FindVisualParent <DataGridRow>(e.OriginalSource as UIElement);
                if (null != row)
                {
                    SolibriProperties sp = row.Item as SolibriProperties;
                    if (null != sp)
                    {
                        OpenFileDialog openDialog = new OpenFileDialog();
                        openDialog.Title            = "Specify an excutable of Solibri";
                        openDialog.Multiselect      = false;
                        openDialog.RestoreDirectory = true;
                        openDialog.Filter           = "Application (*.exe)|*.exe";
                        if ((bool)openDialog.ShowDialog())
                        {
                            string exeFile = openDialog.FileName;

                            int index = settings.Options.SolibriOptions.IndexOf(sp);
                            this.Settings.Options.SolibriOptions[index].ExeFile = exeFile;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                string message = ex.Message;
            }
        }