示例#1
0
        private async void Init(List <Server> servers)
        {
            _model = new ImportDialogModel();
            _serversCombo.SelectedIndexChanged += OnServerChanged;
            _serversCombo.DataStore             = servers;
            _projectCombo.SelectedIndexChanged += OnProjectChanged;
            _projectCombo.DataStore             = await _model.GetProjects();

            _configCombo.SelectedIndexChanged += OnConfigChanged;
            var importButton = new Button {
                Text = "Import"
            };

            importButton.Click += (sender, e) =>
            {
                Result = true;
                Close();
            };
            var cancelButton = new Button {
                Text = "Cancel"
            };

            cancelButton.Click += (sender, e) => Close();
            _gridView.DataStore = _dataStore;
            _gridView.Columns.Add(new GridColumn {
                HeaderText = "Artifacts source",
                DataCell   = new TextBoxCell("Source"),
                Sortable   = true,
                Resizable  = true,
                AutoSize   = true,
            });
            _gridView.Columns.Add(new GridColumn {
                HeaderText = "Artifacts path",
                DataCell   = new TextBoxCell("PathRules"),
                Sortable   = true,
                Resizable  = true,
                AutoSize   = true,
                Editable   = true
            });
            _gridView.GridLines  = GridLines.Both;
            _gridView.ShowHeader = true;
            _gridView.Height     = 300;
            Title     = "Import dependencies from TeamCity";
            Width     = 600;
            Height    = 600;
            Resizable = true;
            var content = new TableLayout {
                ClientSize = new Size(600, 600),
                Padding    = new Padding(10, 10, 10, 5),
                Spacing    = new Size(5, 5),
                Rows       =
                {
                    new TableRow(new StackLayout {
                        Spacing     = 5,
                        Orientation = Orientation.Horizontal,
                        Items       =
                        {
                            new Label            {
                                Text = "Server:"
                            },
                            _serversCombo
                        }
                    }),
                    new TableRow(new Label       {
                        Text = "Condition to apply to all dependencies:"
                    }),
                    new TableRow(new StackLayout {
                        Spacing     = 5,
                        Orientation = Orientation.Horizontal,
                        Items       =
                        {
                            _win32,
                            _win64,
                            _linux32,
                            _linux64
                        }
                    }),
                    new TableRow(new Label       {
                        Text = "Project"
                    }),
                    new TableRow(_projectCombo),
                    new TableRow(new Label       {
                        Text = "Build Configurations"
                    }),
                    new TableRow(_configCombo),
                    new TableRow(new Label       {
                        Text = "Dependencies"
                    }),
                    new TableRow(_gridView)
                    {
                        ScaleHeight = true
                    },
                    new TableRow(new Label       {
                        Text = "Click Import to import the dependencies of the selected configuration."
                    }),
                    new TableRow(new StackLayout {
                        Orientation = Orientation.Horizontal,
                        Spacing     = 5,
                        Items       =
                        {
                            _spinner,
                            null,
                            importButton,
                            cancelButton
                        }
                    })
                }
            };

            Content       = content;
            DefaultButton = importButton;
            AbortButton   = cancelButton;
            _serversCombo.SelectedIndex = 0;
            _projectCombo.SelectedIndex = 0;
        }
示例#2
0
        private async void Init(bool isAddDialog, List <Server> servers)
        {
            _model    = new ImportDialogModel();
            Title     = isAddDialog ? "Add New Artifact Dependency" : "Edit Artifact Dependency";
            Width     = 600;
            Height    = 600;
            Resizable = true;
            _serversCombo.SelectedIndexChanged += OnServerChanged;
            _serversCombo.DataStore             = servers;
            _serversCombo.SelectedIndex         = 0;
            _projectCombo.DataStore             = await _model.GetProjects();

            _projectCombo.SelectedIndexChanged += OnProjectChangedInitial;
            _configCombo.SelectedIndexChanged  += OnConfigChanged;
            _buildTagType.Items.Add("Last successful build");
            _buildTagType.Items.Add("Last pinned build");
            _buildTagType.Items.Add("Last finished build");
            _buildTagType.Items.Add("Build with specified build number");
            _buildTagType.Items.Add("Last finished build with specified tag");
            _buildTagType.SelectedIndex         = 0;
            _buildTagType.SelectedIndexChanged += OnArtifactSourceChanged;
            _buildTagEntryLabel = new Label {
                Text          = "Build tag:",
                TextAlignment = TextAlignment.Right,
                Visible       = false
            };
            _rulesTextBox.Height = 150;
            //_rulesTextBox.HorizontalPlacement = HorizontalAlignment.Left;
            _rulesTextBox.TextChanged += (sender, e) => UpdatePreview();
            _preview.Height            = 150;
            //_preview.HeightRequest = 200;
            //_preview.HorizontalPlacement = WidgetPlacement.Start;
            _preview.BackgroundColor = Colors.LightGrey;
            var okButton = new Button {
                Text = "Save"
            };

            okButton.Click += (sender, e) =>
            {
                Result = true;
                Close();
            };
            var cancelButton = new Button {
                Text = "Cancel"
            };

            cancelButton.Click += (sender, e) => Close();
            _table              = new TableLayout {
                Padding = new Padding(10, 10, 10, 0),
                Spacing = new Size(5, 5),
                Rows    =
                {
                    new TableRow("Server:",             _serversCombo),
                    new TableRow("Depend on:",          new StackLayout()
                    {
                        Orientation = Orientation.Vertical,
                        HorizontalContentAlignment = HorizontalAlignment.Stretch,
                        Items =
                        {
                            _projectCombo,
                            _configCombo
                        }
                    }),
                    new TableRow("Get Artifacts from:", _buildTagType),
                    new TableRow(_buildTagEntryLabel,   _buildTagEntry),
                    new TableRow(new Label {
                        Text = "Artifact rules:",
                        VerticalAlignment = VerticalAlignment.Top
                    },                                  new TableLayout {
                        Rows =
                        {
                            new TableRow(_rulesTextBox)
                            {
                                ScaleHeight = true
                            },
                            new TableRow(new Label {
                                Text = "Newline-delimited set or rules in the form of\n[+:|-:]SourcePath[!ArchivePath][=>DestinationPath]"
                            })
                        }
                    })
                    {
                        ScaleHeight = true
                    },
                    new TableRow("Condition:",          new StackLayout {
                        Spacing     = 5,
                        Orientation = Orientation.Horizontal,
                        Items       =
                        {
                            _win32,
                            _win64,
                            _linux32,
                            _linux64
                        }
                    }),
                    new TableRow("Preview:",            _preview),
                    new TableRow(new StackLayout {
                        Orientation = Orientation.Horizontal,
                        Spacing     = 5,
                        Items       =
                        {
                            _spinner,
                            null
                        }
                    },                                  new StackLayout {
                        Orientation = Orientation.Horizontal,
                        Spacing     = 5,
                        Items       =
                        {
                            null,
                            okButton,
                            cancelButton
                        }
                    })
                }
            };
            DefaultButton = okButton;
            AbortButton   = cancelButton;
            Content       = _table;

            // This can happen because we run async
            if (_artifactToLoad != null)
            {
                LoadArtifact(_artifactToLoad);
            }
        }