コード例 #1
0
        public IterationPicker(Tfs tfs)
        {
            InitializeComponent();

            //initialize dataset
            _dataSet   = new DataSet();
            _dataTable = _dataSet.Tables.Add("IterationSelection");
            _dataTable.Columns.Add(new DataColumn("IsSelected", typeof(bool)));
            _dataTable.Columns.Add(new DataColumn("Platform", typeof(bool)));
            _dataTable.Columns.Add(new DataColumn("Iteration", typeof(string)));
            _dataTable.Columns.Add(new DataColumn("Id", typeof(int)));
            _dataTable.Columns[0].DefaultValue = false;

            _tfs = tfs;

            Projects.Items.Clear();
            Projects.Items.Add("-- Select --");
            Projects.SelectedIndex = 0;


            string selectedProject = "";

            if (ConfigurationManager.AppSettings["DefaultProject"] != null)
            {
                selectedProject = ConfigurationManager.AppSettings["DefaultProject"].ToString();
            }

            int i = 0;

            foreach (string project in _tfs.Projects)
            {
                Projects.Items.Add(project);

                if (project == selectedProject)
                {
                    _edsIndex = i + 1;
                }
                i++;
            }
        }
コード例 #2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            var version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;

            this.Text = string.Format(this.Text, version.Major + "." + version.Minor + "." + version.Revision);

            var progress = new Progress();

            progress.FormClosed += progress_FormClosed;

            try
            {
                if (ConfigurationManager.AppSettings["TFSUri"] == null)
                {
                    System.Windows.Forms.MessageBox.Show("TFS Uri not set in config file");
                    System.Windows.Forms.Application.Exit();
                }

                int autoRefreshInterval = 300000;
                if (ConfigurationManager.AppSettings["AutoRefreshInterval"] != null)
                {
                    int.TryParse(ConfigurationManager.AppSettings["AutoRefreshInterval"], out autoRefreshInterval);
                }

                timer1.Interval = autoRefreshInterval;

                string tfsUriStr = ConfigurationManager.AppSettings["TFSUri"].ToString();
                if (!Uri.IsWellFormedUriString(tfsUriStr, UriKind.Absolute))
                {
                    System.Windows.Forms.MessageBox.Show("TFS Uri in config file is not valid");
                    System.Windows.Forms.Application.Exit();
                }

                tfs = new Tfs(new Uri(tfsUriStr));
                TableHelper._tfs   = tfs;
                TableHelper._table = _table;
                var picker = new IterationPicker(tfs);
                if (picker.ShowDialog(this) == System.Windows.Forms.DialogResult.OK && picker.SelectedIterations != null)
                {
                    progress.Show(this);

                    System.Windows.Forms.Application.DoEvents();

                    System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
                    sw.Start();
                    this.Cursor = Cursors.WaitCursor;
                    List <IterationSelection> selections = picker.SelectedIterations;
                    TableHelper.LoadSuccesors = picker.LoadSuccesors;

                    SetIterationsGrid(selections);

                    TableHelper.SetTable(selections, _table, tfs);
                    this.Cursor = Cursors.Default;
                    sw.Stop();
                    var secs = sw.Elapsed.TotalSeconds;
                    System.Diagnostics.Debug.WriteLine(secs);
                }
                else
                {
                    System.Windows.Forms.Application.Exit();
                }

                picker.Dispose();
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show("Could not connect : " + ex.Message + System.Environment.NewLine + ex.StackTrace);
                System.Windows.Forms.Application.Exit();
            }
            finally
            {
                progress.FormClosed -= progress_FormClosed;
                progress.Close();
            }
        }
コード例 #3
0
ファイル: TableHelper.cs プロジェクト: kjhannaford/PIPlanner
        private static void AddIterations(List <IterationSelection> selections, Grid table, Tfs tfs)
        {
            //Find all iterations for all the teams in selections
            var iterationsDict = new Dictionary <string, List <Iteration> >();

            foreach (var selection in selections)
            {
                foreach (var subIteration in selection.SubIterations)
                {
                    string subIterationText = GetIterationText(subIteration.Path);
                    if (!iterationsDict.Keys.Contains(subIterationText))
                    {
                        iterationsDict.Add(subIterationText, new List <Iteration>()
                        {
                            subIteration
                        });
                    }
                    else
                    {
                        iterationsDict[subIterationText].Add(subIteration);
                    }
                    System.Windows.Forms.Application.DoEvents();
                }
            }

            table.ColumnDefinitions.Add(new ColumnDefinition());
            int column = 1;

            foreach (var iteration in iterationsDict.Keys)
            {
                table.ColumnDefinitions.Add(new ColumnDefinition());
                var lbl = new TextBlock()
                {
                    Tag                 = iterationsDict[iteration],
                    Text                = iteration,
                    Foreground          = System.Windows.Media.Brushes.DarkSlateBlue,
                    FontWeight          = FontWeights.UltraBold,
                    TextWrapping        = TextWrapping.Wrap,
                    HorizontalAlignment = HorizontalAlignment.Center,
                    Padding             = new Thickness(0, 5, 0, 5)
                };
                Grid.SetRow(lbl, 0);
                Grid.SetColumn(lbl, column);
                table.Children.Add(lbl);

                int row = 0;
                foreach (var teamIteration in iterationsDict[iteration])
                {
                    var sp = new StackPanel();

                    var selection = selections.FirstOrDefault(it => it.SubIterations.FirstOrDefault(sit => sit.Id == teamIteration.Id) != null);

                    for (int i = 0; i <= _table.RowDefinitions.Count; i++)
                    {
                        if (table.RowDefinitions[i].Tag == selection.Iteration)
                        {
                            row = i;
                            break;
                        }
                    }

                    var header = new TextBlock()
                    {
                        Tag = teamIteration, Text = teamIteration.Path, Background = Brushes.Black, Foreground = Brushes.White
                    };
                    header.PreviewDragEnter += header_DragEnter;
                    header.PreviewDrop      += header_Drop;
                    header.AllowDrop         = true;
                    header.Padding           = new Thickness(2);
                    var lv = new ListView();
                    lv.PreviewMouseLeftButtonDown += lv_PreviewMouseLeftButtonDown;
                    lv.PreviewMouseMove           += lv_PreviewMouseMove;
                    lv.Tag = teamIteration;

                    var teamIterationWorkItems = tfs.GetWorkItemsUnderIterationPath(teamIteration.Path);
                    List <ListViewItem> wis    = new List <ListViewItem>();
                    foreach (var teamIterationWorkItem in teamIterationWorkItems)
                    {
                        var lvi = GetLviForWi(teamIterationWorkItem);
                        wis.Add(lvi);
                    }
                    lv.ItemsSource = wis;

                    sp.Children.Add(header);
                    sp.Children.Add(lv);

                    Grid.SetRow(sp, row);
                    Grid.SetColumn(sp, column);
                    table.Children.Add(sp);

                    System.Windows.Forms.Application.DoEvents();
                }

                column++;
            }
        }
コード例 #4
0
ファイル: TableHelper.cs プロジェクト: kjhannaford/PIPlanner
 internal static void SetTable(List <IterationSelection> selections, Grid table, Tfs tfs)
 {
     ClearTable(table);
     System.Windows.Forms.Application.DoEvents();
     AddTeams(selections, table);
     System.Windows.Forms.Application.DoEvents();
     AddIterations(selections, table, tfs);
 }
コード例 #5
0
ファイル: TableHelper.cs プロジェクト: apsbrar/PIPlanner
        internal static void SetTable(List <IterationSelection> selections, Grid table, Tfs tfs)
        {
            _listViewItems = new List <ListViewItem>();
            _sb            = new StringBuilder();
            _dependencies.Clear();
            ClearTable(table);
            System.Windows.Forms.Application.DoEvents();
            AddTeams(selections, table);
            System.Windows.Forms.Application.DoEvents();

            List <IterationSelection> engSelections    = selections.Where(sel => !sel.Platform).ToList();
            List <IterationSelection> pltfrmSelections = selections.Where(sel => sel.Platform).ToList();

            AddIterations(engSelections, pltfrmSelections, table, tfs);
            _listViewItems.Clear();
            _sb = null;
        }
コード例 #6
0
ファイル: Main.cs プロジェクト: kjhannaford/PIPlanner
        private void Form1_Load(object sender, EventArgs e)
        {
            var progress = new Progress();

            progress.FormClosed += progress_FormClosed;

            try
            {
                if (ConfigurationManager.AppSettings["TFSUri"] == null)
                {
                    System.Windows.Forms.MessageBox.Show("TFS Uri not set in config file");
                    System.Windows.Forms.Application.Exit();
                }

                string tfsUriStr = ConfigurationManager.AppSettings["TFSUri"].ToString();
                if (!Uri.IsWellFormedUriString(tfsUriStr, UriKind.Absolute))
                {
                    System.Windows.Forms.MessageBox.Show("TFS Uri in config file is not valid");
                    System.Windows.Forms.Application.Exit();
                }

                tfs = new Tfs(new Uri(tfsUriStr));
                TableHelper._tfs   = tfs;
                TableHelper._table = _table;
                var picker = new IterationPicker(tfs);
                if (picker.ShowDialog(this) == System.Windows.Forms.DialogResult.OK && picker.SelectedIterations != null)
                {
                    progress.Show(this);

                    System.Windows.Forms.Application.DoEvents();

                    System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
                    sw.Start();
                    this.Cursor = Cursors.WaitCursor;
                    List <IterationSelection> selections = picker.SelectedIterations;

                    SetIterationsGrid(selections);

                    TableHelper.SetTable(selections, _table, tfs);
                    this.Cursor = Cursors.Default;
                    sw.Stop();
                    var secs = sw.Elapsed.TotalSeconds;
                    System.Diagnostics.Debug.WriteLine(secs);
                }
                else
                {
                    System.Windows.Forms.Application.Exit();
                }

                picker.Dispose();
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show("Could not connect : " + ex.Message + System.Environment.NewLine + ex.StackTrace);
                System.Windows.Forms.Application.Exit();
            }
            finally
            {
                progress.FormClosed -= progress_FormClosed;
                progress.Close();
            }
        }