Ejemplo n.º 1
0
 public Dialog(string title, string message, string buttonText, string hideButtonText, Action action, FormLocation ownerLocation = null)
 {
     InitializeComponent();
     this.Text          = "";
     this.ownerLocation = ownerLocation;
     lblTitle.Text      = titleText = title;
     lblMessage.Text    = message;
     this.action        = action;
     btnBackground.Text = buttonText;
     btnBackground.Text = hideButtonText;
 }
Ejemplo n.º 2
0
        private async void lnkTrainModel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            var count = await DbTrainDataCollection.Find(i => true).CountDocumentsAsync();

            if (count > 1)
            {
                cbxDataBases.Enabled            = false;
                cbxChatProfiles.Enabled         = false;
                lnkProgressResultAction.Visible = true;
                lnkProgressResultAction.Enabled = false;
                lnkProgressResultAction.Text    = $"Trainig the model for profile {cbxChatProfiles.SelectedItem}";
                lnkTrainModel.Enabled           = false;
                var location = new FormLocation {
                    Location = Location, Height = Height, Width = Width
                };
                await Task.Run(() =>
                {
                    var loader = new Dialog("Training your data model", "Good things take time!", "Cancel", "Continue editing",
                                            () => new NeuralTrainingEngine().BuildAndSaveModel(), location);
                    loader.ShowDialog();
                }).ConfigureAwait(true);

                lnkTrainModel.Text = await GetTrainModelText();

                var traindataCreated = await CurrentModelFileExists();

                if (traindataCreated)
                {
                    lnkProgressResultAction.Enabled = true;
                    lnkProgressResultAction.Text    = ActionResultDeleteProfile;
                }
                else
                {
                    lnkProgressResultAction.Visible = false;
                }
                lnkTrainModel.Enabled   = true;
                cbxChatProfiles.Enabled = true;
                cbxDataBases.Enabled    = true;
            }
        }
Ejemplo n.º 3
0
 public Dialog(string title, string message, string buttonText, Action action, FormLocation ownerLocation = null)
 {
     InitializeComponent();
     if (ownerLocation != null)
     {
         Location = new Point(ownerLocation.Location.X + ownerLocation.Width / 2 - Width / 2,
                              ownerLocation.Location.Y + ownerLocation.Height / 2 - Height / 2);
     }
     else
     {
         StartPosition = FormStartPosition.CenterScreen;
     }
     lblTitle.Text   = title;
     lblMessage.Text = message;
     this.action     = action;
     btnCancel.Text  = buttonText;
 }