/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ReferenceEditorForm)); this.ReferenceEditor = new DataTierClient.Controls.ReferenceEditor(); this.SuspendLayout(); // // ReferenceEditor // this.ReferenceEditor.BackColor = System.Drawing.Color.Linen; this.ReferenceEditor.Dock = System.Windows.Forms.DockStyle.Fill; this.ReferenceEditor.Location = new System.Drawing.Point(0, 0); this.ReferenceEditor.Name = "ReferenceEditor"; this.ReferenceEditor.Size = new System.Drawing.Size(664, 136); this.ReferenceEditor.TabIndex = 0; this.ReferenceEditor.UserCancelled = true; // // ReferenceEditorForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(664, 136); this.Controls.Add(this.ReferenceEditor); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Name = "ReferenceEditorForm"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "Create New Reference"; this.ResumeLayout(false); }
public override void OnFrameworkInitializationCompleted() { if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktopLifetime) { var jsonSettings = new JsonSerializerSettings() { PreserveReferencesHandling = PreserveReferencesHandling.Objects }; string settingPath = "settings.json"; ReferenceEditor? editor = default; try { if (File.Exists(settingPath)) { string json = File.ReadAllText(settingPath); editor = JsonConvert.DeserializeObject<ReferenceEditor>(json, jsonSettings); } } catch (Exception ex) { Logger.Log(ex.Message); if (ex.StackTrace != null) { Logger.Log(ex.StackTrace); } } if (editor == null) { var feeds = new ObservableCollection<Feed> { new Feed("api.nuget.org", "https://api.nuget.org/v3/index.json"), new Feed("dotnet-core", "https://dotnet.myget.org/F/dotnet-core/api/v3/index.json"), new Feed("avalonia-ci", "https://www.myget.org/F/avalonia-ci/api/v3/index.json"), new Feed("avalonia-prs", "https://www.myget.org/F/avalonia-prs/api/v3/index.json"), new Feed("xamlbehaviors-nightly", "https://www.myget.org/F/xamlbehaviors-nightly/api/v3/index.json"), new Feed("panandzoom-nightly", "https://www.myget.org/F/panandzoom-nightly/api/v3/index.json"), new Feed("dock-nightly", "https://www.myget.org/F/dock-nightly/api/v3/index.json"), new Feed("portable-xaml", "https://ci.appveyor.com/nuget/portable-xaml") }; var patterns = new ObservableCollection<string> { "*.props", "*.csproj" }; editor = new ReferenceEditor() { Feeds = feeds, CurrentFeed = feeds.FirstOrDefault(), SearchPath = @"C:\DOWNLOADS\GitHub", SearchPatterns = patterns, SearchPattern = patterns.FirstOrDefault(), AlwaysUpdate = false }; } editor.Result = new UpdaterResult() { Documents = new ObservableCollection<XmlDocument>(), References = new ObservableCollection<PackageReference>() }; desktopLifetime.MainWindow = new MainWindow() { DataContext = editor }; desktopLifetime.Exit += (sennder, e) => { try { var json = JsonConvert.SerializeObject(editor, Newtonsoft.Json.Formatting.Indented, jsonSettings); File.WriteAllText(settingPath, json); } catch (Exception ex) { Logger.Log(ex.Message); if (ex.StackTrace != null) { Logger.Log(ex.StackTrace); } } }; } else if (ApplicationLifetime is ISingleViewApplicationLifetime singleViewLifetime) { //singleViewLifetime.MainView = new MainView(); } base.OnFrameworkInitializationCompleted(); }
public static Control GetPropertyValueEditor(FastTrackPage page, Type type, PropertyInfo property) { Control editor = null; if (page.IsListProperty(type, property.Name)) { editor = new ListEditor(property.Name); } else { Type propertyType = property.PropertyType; if (propertyType.IsEnum) { editor = new EnumerationEditor(property.Name); } else if (propertyType.IsPrimitive) { if (propertyType == typeof(bool)) { editor = new BooleanEditor(property.Name); } else if (propertyType == typeof(Int16) || propertyType == typeof(Int32) || propertyType == typeof(Int64) || propertyType == typeof(Byte)) { editor = new NumberEditor(property.Name); } } else if (propertyType.IsValueType) { if (propertyType == typeof(DateTime)) { editor = new DateTimeEditor(property.Name); } else if (propertyType == typeof(Decimal)) { editor = new NumberEditor(property.Name); } } else if (propertyType.IsClass) { if (propertyType == typeof(string)) { editor = new StringEditor(property.Name); } else if (propertyType == typeof(byte[])) { ; //editor = new DateTimeEditor(property.Name); } else { editor = new ReferenceEditor(property.Name); } } } return(editor); }
public static void CustomizeControl(ReferenceEditor referenceEditor, EditFormMode mode) { CheckHelper.ArgumentNotNull(referenceEditor, "referenceEditor"); referenceEditor.ReadOnly = mode == EditFormMode.View; }