Exemplo n.º 1
0
 public static ServerTemplate Add(ServerTemplate Template)
 {
     if (TemplateExists(Template.Server))
         throw new Exception("Template already exists.");
     _Templates.Add(Template);
     Save();
     return Template;
 }
Exemplo n.º 2
0
 public static ServerTemplate Add(Uri Server)
 {
     if (TemplateExists(Server))
         throw new Exception("Template already exists.");
     var s = new ServerTemplate(Server);
     _Templates.Add(s);
     Core.Core.getServerID(Server);
     Save();
     return s;
 }
Exemplo n.º 3
0
		public static ServerTemplate fromXml(XmlReader Reader)
		{
			var tmp = new ServerTemplate();
			((IXmlSerializable)tmp).ReadXml(Reader);
			return tmp;
		}
Exemplo n.º 4
0
 public static void Remove(ServerTemplate Template)
 {
     Remove(Template.Server);
 }
 public void New()
 {
     SelectedSettings = null;
 }
 public void Reset()
 {
     SelectedSettings = null;
 }
 public bool Apply()
 {
     try
     {
         if (_SelectedSettings != null)
         {
             if (MessageBox.Show("Do you really want to replace setiings for this server?", "???", MessageBoxButton.YesNo) == MessageBoxResult.No)
             {
                 if (MessageBox.Show("Maybe you want to add a new server?", "???", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                 {
                     _SelectedSettings = null;
                     NotifyPropertyChanged(nameof(SelectedSettings));
                 }
                 return false;
             }
             SettingsToTemplate(_SelectedSettings);
             Templates.Save();
             IsEdited = false;
             return true;
         }
         var tmpl = new ServerTemplate(new Uri(Url));
         SettingsToTemplate(tmpl);
         Templates.Add(tmpl);
         SelectedSettings = tmpl;
         IsEdited = false;
         return true;
     }
     catch (Exception e)
     {
         MessageBox.Show(e.Message);
     }
     return false;
 }
 void SettingsToTemplate(ServerTemplate tmpl)
 {
     _GeneratorModel.CheckIsConfigured();
     _ParserModel.CheckIsConfigured();
     tmpl.Parser = _ParserModel.Settings;
     tmpl.PageGenerator = _GeneratorModel.Settings;
     tmpl.FileMask = FileMask;
     tmpl.PreviewMask = PreviewMask;
 }