Ejemplo n.º 1
0
        public MainWindow()
        {
            InitializeComponent();

            pathToGit = new FileInfo(@"C:\Program Files (x86)\Git\bin\git.exe");
            try
            {
                DirectoryCatalog catalog =
                    new DirectoryCatalog(new FileInfo(Assembly.GetAssembly(typeof(MainWindow)).Location).DirectoryName);
                CompositionContainer container = new CompositionContainer(catalog);
                container.ComposeParts(this);
            }
            catch (CompositionException)
            {
                sqlParser = null;
            }

            var vm = new MainWindowViewModel(Properties.Settings.Default.Databases);

            vm.SourceChangeset = (DvcsScriptRepositoryBase.RevisionIdentifierBase)Properties.Settings.Default.LastChangeset ?? Properties.Settings.Default.LastTag;
            if (vm.SourceChangeset != null)
            {
                vm.SelectedSourceType = RevisionIdentifierConverter.GetLabelFromType(vm.SourceChangeset.GetType());
            }

            var riConverter = (RevisionIdentifierConverter)Resources["riConverter"];

            riConverter.DataContext = vm;
            DataContext             = vm;
        }
Ejemplo n.º 2
0
        private void cbSourceType_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            var vm = DataContext as MainWindowViewModel;

            if (vm != null && vm.SourceChangeset != null &&
                vm.SelectedSourceType != RevisionIdentifierConverter.GetLabelFromType(vm.SourceChangeset.GetType()))
            {
                vm.SourceChangeset = null;
            }
        }