1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2025-05-08 02:34:06 +02:00

Add essential classes - entry point and the browser Form

This commit is contained in:
chylex 2016-04-09 15:46:59 +02:00
parent 8a73b9bd1e
commit 660ac2c1e5
3 changed files with 95 additions and 0 deletions

41
Forms/FormBrowser.Designer.cs generated Normal file
View File

@ -0,0 +1,41 @@
namespace TweetDick.Forms {
partial class FormBrowser {
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing) {
if (disposing && (components != null)) {
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent() {
this.SuspendLayout();
//
// FormBrowser
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Name = "FormBrowser";
this.Text = "TweetDick";
this.ResumeLayout(false);
}
#endregion
}
}

15
Forms/FormBrowser.cs Normal file
View File

@ -0,0 +1,15 @@
using System.Windows.Forms;
using CefSharp.WinForms;
namespace TweetDick.Forms{
public partial class FormBrowser : Form{
private readonly ChromiumWebBrowser browser;
public FormBrowser(){
InitializeComponent();
browser = new ChromiumWebBrowser("https://tweetdeck.twitter.com/");
Controls.Add(browser);
}
}
}

39
Program.cs Normal file
View File

@ -0,0 +1,39 @@
using CefSharp;
using System;
using System.Globalization;
using System.Windows.Forms;
using TweetDick.Forms;
namespace TweetDick{
static class Program{
private static string HeaderAcceptLanguage{
get{
string culture = CultureInfo.CurrentCulture.Name;
if (culture == "en"){
return "en-us,en";
}
else{
return culture.ToLowerInvariant()+",en;q=0.9";
}
}
}
[STAThread]
private static void Main(){
Cef.Initialize(new CefSettings{
AcceptLanguageList = HeaderAcceptLanguage,
UserAgent = "TweetDick "+Application.ProductVersion,
Locale = CultureInfo.CurrentCulture.TwoLetterISOLanguageName
});
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new FormBrowser());
Application.ApplicationExit += (sender, args) => {
Cef.Shutdown();
};
}
}
}