private async void Window_Loaded(object sender, RoutedEventArgs e) { IsEnabled = false; var exists = File.Exists(settingsPath); var result = exists ? await Op.TryAsync(Op.UsingAsync(new StreamReader(settingsPath, Encoding.UTF8), LinkSettings.CreateAsync)) : default; if (exists && result.IsError) { MessageBox.Show(result.UnwrapError().Message, "Error while loading settings", MessageBoxButton.OK, MessageBoxImage.Error); } client = new LinkClient(result.UnwrapOrDefault() ?? LinkSettings.Create(), TaskScheduler.FromCurrentSynchronizationContext()); if (exists == false || result.IsError) { client.Profile.Name = string.Concat(Environment.UserName, "@", Environment.MachineName); } DataContext = client.Profile; IsEnabled = true; }
public ClangToolchainSettings() { CompileSettings = new CompileSettings(); LinkSettings = new LinkSettings(); }
public GccToolchainSettings() { CompileSettings = new CompileSettings(); LinkSettings = new LinkSettings(); }
public ArmGCCLinkTemplate(LinkSettings linkSettings) { this.linkSettings = linkSettings; }
public HomeController(ILogger <HomeController> logger, SampleSettings settings, LinkSettings links) { _logger = logger ?? throw new ArgumentNullException(nameof(settings)); _settings = settings ?? throw new ArgumentNullException(nameof(settings)); _links = links ?? throw new ArgumentNullException(nameof(links)); }
public bool SaveSettings() { MessageDisplay msgDisplay = CreateMessageDisplay("url", "name"); int rowindex = 0; int[] linkids = StringUtil.Split <int>(_Request.Get("linkids", Method.Post)); LinkSettings settings = SettingManager.CloneSetttings <LinkSettings>(AllSettings.Current.LinkSettings); LinkCollection links = new LinkCollection(); Link temp; foreach (int id in linkids) { temp = new Link(); temp.LinkID = id; temp.Url = _Request.Get("url." + id, Method.Post); temp.Name = _Request.Get("name." + id, Method.Post); temp.ImageUrlSrc = _Request.Get("imageurl." + id, Method.Post); temp.Description = _Request.Get("description." + id, Method.Post); temp.Index = _Request.Get <int>("index." + id, Method.Post, 0); temp.IsNew = _Request.Get <bool>("isnew." + id, Method.Post, false); ValidateLink(temp, msgDisplay, rowindex); rowindex++; links.Add(temp); } ///客户端无脚本 if (_Request.Get("newlinkid", Method.Post) != null && _Request.Get("newlinkid").Contains("{0}")) { temp = settings.CreateLink(); temp.Url = _Request.Get("url.new.{0}", Method.Post); temp.Name = _Request.Get("name.new.{0}", Method.Post); temp.ImageUrlSrc = _Request.Get("imageurl.new.{0}", Method.Post); temp.Description = _Request.Get("description.new.{0}", Method.Post); temp.Index = _Request.Get <int>("index.new.{0}", Method.Post, 0); rowindex++; if (!string.IsNullOrEmpty(temp.Name) && !string.IsNullOrEmpty(temp.Url)) { links.Add(temp); } } else { int[] newLinkArray = StringUtil.Split <int>(_Request.Get("newlinkid", Method.Post)); foreach (int id in newLinkArray) { temp = settings.CreateLink(); temp.IsNew = true; temp.Url = _Request.Get("url.new." + id, Method.Post); temp.Name = _Request.Get("name.new." + id, Method.Post); temp.ImageUrlSrc = _Request.Get("imageurl.new." + id, Method.Post); temp.Description = _Request.Get("description.new." + id, Method.Post); temp.Index = _Request.Get <int>("index.new." + id, Method.Post, 0); ValidateLink(temp, msgDisplay, rowindex); rowindex++; links.Add(temp); } } if (msgDisplay.HasAnyError()) { msgDisplay.AddError(new DataNoSaveError()); m_LinkList = links; } else { foreach (Link l in links) { l.IsNew = false; } settings.Links = links; SettingManager.SaveSettings(settings); m_LinkList = null; } return(true); }
public STM32ToolchainSettings() { CompileSettings = new CompileSettings(); LinkSettings = new LinkSettings(); }