예제 #1
0
        private void OnChangeDefaultDropLocation()
        {
            try
            {
                var items            = this.view.SelectedItems;
                var viewModel        = new DropLocationViewModel();
                var lstDropLocations = from b in items orderby b.DefaultDropLocation.Length select b.DefaultDropLocation;

                viewModel.SearchTxt = GetCommonString(lstDropLocations.ToList());

                viewModel.ReplaceTxt      = viewModel.SearchTxt;
                viewModel.SetDropLocation = string.Empty;
                viewModel.AddMacro("$(TeamProject)", "TO BE SET");
                viewModel.AddMacro("$(BuildDefinition)", "TO BE SET");
                viewModel.AddMacro("$(BuildServer)", "TO BE SET");
                viewModel.AddMacro("$(BuildType)", "TO BE SET");

                var  wnd = new DropLocationWindow(viewModel);
                bool?res = wnd.ShowDialog();
                if (res.HasValue && res.Value)
                {
                    using (new WaitCursor())
                    {
                        if (viewModel.ModeReplace)
                        {
                            this.repository.ChangeDefaultDropLocation(items.Select(bd => bd.Uri), viewModel.ReplaceTxt, viewModel.SearchTxt, viewModel.UpdateExistingBuilds);
                            this.OnRefresh(new EventArgs());
                        }
                        else
                        {
                            this.repository.SetDefaultDropLocation(items.Select(bd => bd.Uri), viewModel.SetDropLocation, viewModel.Macros, viewModel.UpdateExistingBuilds);
                            this.OnRefresh(new EventArgs());
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                this.view.DisplayError(ex);
            }
        }
예제 #2
0
        private void OnChangeDefaultDropLocation()
        {
            try
            {
                var items = this.view.SelectedItems.ToList();
                var viewModel = new DropLocationViewModel();
                var lstDropLocations = from b in items orderby b.DefaultDropLocation.Length select b.DefaultDropLocation;
                viewModel.SearchTxt = GetCommonString(lstDropLocations.ToList());
                viewModel.ReplaceTxt = viewModel.SearchTxt;
                viewModel.SetDropLocation = string.Empty;
                viewModel.AddMacro("$(TeamProject)", "TO BE SET");
                viewModel.AddMacro("$(BuildDefinition)", "TO BE SET");
                viewModel.AddMacro("$(BuildServer)", "TO BE SET");
                viewModel.AddMacro("$(BuildType)", "TO BE SET");

                var wnd = new DropLocationWindow(viewModel);
                bool? res = wnd.ShowDialog();
                if (res.HasValue && res.Value)
                {
                    using (new WaitCursor())
                    {
                        if (viewModel.ModeReplace)
                        {
                            this.repository.ChangeDefaultDropLocation(items.Select(bd => bd.Uri), viewModel.ReplaceTxt, viewModel.SearchTxt, viewModel.UpdateExistingBuilds);
                            this.OnRefresh(new EventArgs());
                        }
                        else
                        {
                            this.repository.SetDefaultDropLocation(items.Select(bd => bd.Uri), viewModel.SetDropLocation, viewModel.Macros, viewModel.UpdateExistingBuilds);
                            this.OnRefresh(new EventArgs());
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                this.view.DisplayError(ex);
            }
        }