public RemoteTemplateSettings GetDefaultJsonSettings() { var results = new RemoteTemplateSettings { UpdateInterval = UpdateFrequency.OnceAWeek }; return(results); }
public void WriteJsonTemplateSettings(RemoteTemplateSettings settings) { var filePath = Path.Combine(this.RootDirectory, "templatesources.json"); var json = JsonConvert.SerializeObject(settings, Formatting.Indented); if (!Directory.Exists(RootDirectory)) { Directory.CreateDirectory(RootDirectory); } File.WriteAllText(filePath, json); }
public SettingsForm() { InitializeComponent(); templateBuilder = new DynamicTemplateBuilder( GetService(typeof(DTE)) as DTE2, new ActivityLogger(GetService(typeof(SVsActivityLog)) as IVsActivityLog)); templateSettings = new RemoteTemplateSettings(); NumberOfSources = 0; // Load the list of sources var templateList = templateBuilder.GetTemplateSettingsFromJson(); UpdateInterval = templateList.UpdateInterval.ToString(); LoadSourcesListView(templateList); // Check the box for the user's configuration schedule (default: Once A Week) SetupRadioButtons(UpdateInterval); alwaysRadioBtn.Tag = UpdateFrequency.Always; onceADayRadioBtn.Tag = UpdateFrequency.OnceADay; onceAWeekRadioBtn.Tag = UpdateFrequency.OnceAWeek; onceAMonthRadioBtn.Tag = UpdateFrequency.OnceAMonth; neverRadioBtn.Tag = UpdateFrequency.Never; }
public RemoteTemplateSettings GetTemplateSettingsFromJson() { var rootPath = Path.Combine(this.RootDirectory, "templatesources.json"); var installPath = Path.Combine(this.SideWaffleInstallDir, "templatesources.json"); var results = new RemoteTemplateSettings(); if (File.Exists(rootPath)) { results = RemoteTemplateSettings.ReadFromJson(rootPath); } else { results = RemoteTemplateSettings.ReadFromJson(installPath); } if (results == null || results.Sources == null || results.Sources.Count <= 0) { results = new RemoteTemplateSettings { UpdateInterval = UpdateFrequency.OnceAWeek }; } return(results); }
public void LoadSourcesListView(RemoteTemplateSettings rts) { foreach (var template in rts.Sources) { ListViewItem row = new ListViewItem(); if (template.Enabled) { row.Checked = true; } else { row.Checked = false; } row.SubItems.Add(template.Name); row.SubItems.Add(template.Location.ToString()); row.SubItems.Add(template.Branch); remoteSourceListView.Items.Add(row); NumberOfSources += 1; } }
public void WriteJsonTemplateSettings(RemoteTemplateSettings settings) { var filePath = Path.Combine(this.RootDirectory, "templatesources.json"); var json = JsonConvert.SerializeObject(settings, Formatting.Indented); if (!Directory.Exists(RootDirectory)) { Directory.CreateDirectory(RootDirectory); } File.WriteAllText(filePath, json); }
public RemoteTemplateSettings GetDefaultJsonSettings() { var results = new RemoteTemplateSettings { UpdateInterval = UpdateFrequency.OnceAWeek }; return results; }
public RemoteTemplateSettings GetTemplateSettingsFromJson() { var rootPath = Path.Combine(this.RootDirectory, "templatesources.json"); var installPath = Path.Combine(this.SideWaffleInstallDir, "templatesources.json"); var results = new RemoteTemplateSettings(); if (File.Exists(rootPath)) { results = RemoteTemplateSettings.ReadFromJson(rootPath); } else { results = RemoteTemplateSettings.ReadFromJson(installPath); } if (results == null || results.Sources == null || results.Sources.Count <= 0) { results = new RemoteTemplateSettings { UpdateInterval = UpdateFrequency.OnceAWeek }; } return results; }