Exemplo n.º 1
0
        private void SyncPromoteButton_Click(object sender, EventArgs e)
        {
            string toolsPath = Path.Combine(MOG_ControllerProject.GetProjectPath(), "Tools");

            ComboBoxItem filter = SyncFilterComboBox.SelectedItem as ComboBoxItem;

            if (filter != null)
            {
                string targetFilterName = "";
                string filterFileName   = filter.FullPath;
                if (filterFileName.Contains(MOG_ControllerProject.GetUserPath()))
                {
                    targetFilterName = filterFileName.Replace(MOG_ControllerProject.GetUser().GetUserToolsPath(), toolsPath);
                }
                else
                {
                    // This is a project tool and should be demoted
                    targetFilterName = filterFileName.Replace(toolsPath, MOG_ControllerProject.GetUser().GetUserToolsPath());
                }

                // This is a user tool and should be promoted
                if (DosUtils.FileCopyFast(filterFileName, targetFilterName, true))
                {
                    if (DosUtils.FileDeleteFast(filterFileName))
                    {
                        UpdateFilterDropDown(Path.GetFileNameWithoutExtension(targetFilterName));
                        UpdatePromoteButton();
                    }
                }
            }
        }