private async void SaveScript()
        {
            var masterScript = await MasterScriptDb.GetMasterScript();

            var scriptToBeUpdated = masterScript.Scripts.FirstOrDefault(s => s.ScriptId.Equals(_script.ScriptId));

            if (scriptToBeUpdated != null)
            {
                scriptToBeUpdated.Active            = !IsDisabled;
                scriptToBeUpdated.Name              = ScriptName;
                scriptToBeUpdated.Text              = ScriptContent;
                scriptToBeUpdated.Description       = ScriptDescription;
                scriptToBeUpdated.ScriptStateAction = !IsDisabled ? "Disable" : "Enable";
                scriptToBeUpdated.RowColor          = !IsDisabled ? "Black" : "DarkGray";
                await MasterScriptDb.UpdateScript(masterScript);

                //write masterscript on the disk
                ProcessScript.ExportScript(Path.Combine(masterScript.Location, masterScript.Name), masterScript.Scripts);
                var result = MessageBox.Show("Script edited successfully", string.Empty,
                                             MessageBoxButton.OK, MessageBoxImage.Information);
                if (result == MessageBoxResult.OK)
                {
                    _mainWindowViewModel.LoadScriptsPage();
                }
            }
        }
Esempio n. 2
0
 private void BackToScriptsList()
 {
     _mainWindowViewModel.LoadScriptsPage();
 }