diff --git a/JianGongYun/App.xaml.cs b/JianGongYun/App.xaml.cs
index c44ffeb..cf97065 100644
--- a/JianGongYun/App.xaml.cs
+++ b/JianGongYun/App.xaml.cs
@@ -5,6 +5,7 @@ using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
+using System.Windows.Media.Imaging;
namespace JianGongYun
{
@@ -13,5 +14,19 @@ namespace JianGongYun
///
public partial class App : Application
{
+ public static BitmapImage icon
+ {
+ get
+ {
+ BitmapImage bitmapImage = new BitmapImage();
+ string name = "JianGongYun.lg.ico";
+ System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
+ System.IO.Stream stream = assembly.GetManifestResourceStream(name);
+ bitmapImage.BeginInit();
+ bitmapImage.StreamSource = stream;
+ bitmapImage.EndInit();
+ return bitmapImage;
+ }
+ }
}
}
diff --git a/JianGongYun/JianGongYun.csproj b/JianGongYun/JianGongYun.csproj
index 7144044..4cace9b 100644
--- a/JianGongYun/JianGongYun.csproj
+++ b/JianGongYun/JianGongYun.csproj
@@ -12,6 +12,10 @@
AnyCPU;x64;x86
sznykt
+
+
+
+
@@ -48,6 +52,11 @@
4.5.1.20201229
+
+
+ Never
+
+
diff --git a/JianGongYun/Properties/launchSettings.json b/JianGongYun/Properties/launchSettings.json
index 0613bfb..dc0d16a 100644
--- a/JianGongYun/Properties/launchSettings.json
+++ b/JianGongYun/Properties/launchSettings.json
@@ -2,7 +2,7 @@
"profiles": {
"JianGongYun": {
"commandName": "Project",
- "commandLineArgs": "sznykt://--classhead|测试课程1|--classsubhead|测试章节1|--teacherid|1234_5678|--teachername|王大锤|endtime|MjAyMS0wMy0xOCAyMTo1MDowMA==",
+ "commandLineArgs": "sznykt://--classhead|测试课程1|--classsubhead|测试章节1|--teacherid|1234_5678|--teachername|王大锤|endtime|2022-02-25 11:11:11",
"nativeDebugging": false
}
}
diff --git a/JianGongYun/TRTC/Windows/LiveWindow.xaml.cs b/JianGongYun/TRTC/Windows/LiveWindow.xaml.cs
index 2bb6637..8fa7e05 100644
--- a/JianGongYun/TRTC/Windows/LiveWindow.xaml.cs
+++ b/JianGongYun/TRTC/Windows/LiveWindow.xaml.cs
@@ -35,7 +35,8 @@ namespace JianGongYun.TRTC.Windows
public LiveWindow()
{
InitializeComponent();
- this.Icon = new BitmapImage(new Uri("logo.ico", UriKind.RelativeOrAbsolute));
+ this.Icon = App.icon;
+ //this.Icon = new BitmapImage(new Uri(System.IO.Path.Combine(Environment.CurrentDirectory, "logo.ico"), UriKind.Absolute));
NoticeManager.Initialize();
AttachConsole(-1);//把进程挂在控制台,通过命令行启动程序可以看到控制台输出
LiveWindowViewModel = new ViewModels.LiveWindowViewModel();
diff --git a/JianGongYun/TRTC/Windows/SettingWindow.xaml.cs b/JianGongYun/TRTC/Windows/SettingWindow.xaml.cs
index 2e47dc7..f3957e3 100644
--- a/JianGongYun/TRTC/Windows/SettingWindow.xaml.cs
+++ b/JianGongYun/TRTC/Windows/SettingWindow.xaml.cs
@@ -29,7 +29,8 @@ namespace JianGongYun.TRTC.Windows
{
_Instance = new SettingWindow();
}
- _Instance.Icon= new BitmapImage(new Uri("logo.ico", UriKind.Relative));
+ _Instance.Icon = App.icon;
+ //_Instance.Icon = new BitmapImage(new Uri(System.IO.Path.Combine(Environment.CurrentDirectory, "logo.ico"), UriKind.Absolute));
return _Instance;
}
diff --git a/JianGongYun/Views/Login.xaml.cs b/JianGongYun/Views/Login.xaml.cs
index bed0d21..8c8f100 100644
--- a/JianGongYun/Views/Login.xaml.cs
+++ b/JianGongYun/Views/Login.xaml.cs
@@ -31,77 +31,93 @@ namespace JianGongYun.Views
public Login()
{
InitializeComponent();
- this.Icon = new BitmapImage(new Uri("logo.ico", UriKind.Relative));
- string errMsg = "", classHead = default, classSubHead = default, teacherId = default, teacherName = default, endtime = default;
- var urltemps = Environment.GetCommandLineArgs();
- if (urltemps.Length < 2)
+ try
{
- errMsg = $"Startup Parameter Null";
- goto Skip;
- }
- var first = urltemps[1];
- if (!first.StartsWith("sznykt"))
- {
- errMsg = "Startup Parameter Error";
- goto Skip;
- }
- var args = HttpUtility.UrlDecode(first, Encoding.UTF8).Replace("://", "|").Split("|");
- int indexTemp = Array.IndexOf(args, CLASS_HEAD);
- if (indexTemp < 0)
- {
- errMsg = $"{nameof(classHead)} NULL";
- goto Skip;
- }
- classHead = args[indexTemp + 1];
+ //this.Icon = new BitmapImage(new Uri("lg.ico", UriKind.Relative));
+ this.Icon = App.icon;
+ //this.Icon = new BitmapImage(new Uri(System.IO.Path.Combine(Environment.CurrentDirectory, "logo.ico"), UriKind.Absolute));
+ string errMsg = "", classHead = default, classSubHead = default, teacherId = default, teacherName = default, endtime = default;
+ var urltemps = Environment.GetCommandLineArgs();
+ if (urltemps.Length < 2)
+ {
+ errMsg = $"Startup Parameter Null";
+ goto Skip;
+ }
+ var first = urltemps[1];
+ if (!first.StartsWith("sznykt"))
+ {
+ errMsg = "Startup Parameter Error";
+ goto Skip;
+ }
- indexTemp = Array.IndexOf(args, CLASS_SUB_HEAD);
- if (indexTemp < 0)
- {
- errMsg = $"{nameof(CLASS_SUB_HEAD)} NULL";
- goto Skip;
- }
- classSubHead = args[indexTemp + 1];
+ var u = HttpUtility.UrlDecode(first, Encoding.UTF8);
+ if (u.EndsWith('/'))
+ {
+ u = u.Substring(0, u.Length - 1);
+ }
+ var args = u.Replace("://", "|").Split("|");
+ int indexTemp = Array.IndexOf(args, CLASS_HEAD);
+ if (indexTemp < 0)
+ {
+ errMsg = $"{nameof(classHead)} NULL";
+ goto Skip;
+ }
+ classHead = args[indexTemp + 1];
- indexTemp = Array.IndexOf(args, TEACHER_ID);
- if (indexTemp < 0)
- {
- errMsg = $"{nameof(TEACHER_ID)} NULL";
- goto Skip;
- }
- teacherId = args[indexTemp + 1];
+ indexTemp = Array.IndexOf(args, CLASS_SUB_HEAD);
+ if (indexTemp < 0)
+ {
+ errMsg = $"{nameof(CLASS_SUB_HEAD)} NULL";
+ goto Skip;
+ }
+ classSubHead = args[indexTemp + 1];
- indexTemp = Array.IndexOf(args, TEACHER_NAME);
- if (indexTemp < 0)
- {
- errMsg = $"{nameof(TEACHER_NAME)} NULL";
- goto Skip;
- }
- teacherName = args[indexTemp + 1];
+ indexTemp = Array.IndexOf(args, TEACHER_ID);
+ if (indexTemp < 0)
+ {
+ errMsg = $"{nameof(TEACHER_ID)} NULL";
+ goto Skip;
+ }
+ teacherId = args[indexTemp + 1];
- indexTemp = Array.IndexOf(args, END_TIME);
- if (indexTemp < 0)
- {
- errMsg = $"{nameof(END_TIME)} NULL";
- goto Skip;
- }
- endtime = args[indexTemp + 1];
+ indexTemp = Array.IndexOf(args, TEACHER_NAME);
+ if (indexTemp < 0)
+ {
+ errMsg = $"{nameof(TEACHER_NAME)} NULL";
+ goto Skip;
+ }
+ teacherName = args[indexTemp + 1];
- Skip:
- if (!string.IsNullOrWhiteSpace(errMsg))
+ indexTemp = Array.IndexOf(args, END_TIME);
+ if (indexTemp < 0)
+ {
+ errMsg = $"{nameof(END_TIME)} NULL";
+ goto Skip;
+ }
+ endtime = args[indexTemp + 1];
+
+ Skip:
+ if (!string.IsNullOrWhiteSpace(errMsg))
+ {
+ MessageBox.Show(errMsg, "错误", MessageBoxButton.OKCancel, MessageBoxImage.Error);
+ Environment.Exit(0);
+ return;
+ }
+ LiveClassroom.EnterTheClassroom(Window.GetWindow(this),
+ new TRTC.Models.ClassroomEntity
+ {
+ ClassHead = classHead,
+ ClassSubHead = classSubHead,
+ TeacherId = teacherId,
+ TeacherName = teacherName,
+ EndTime = string.IsNullOrEmpty(endtime) ? null : new DateTime?(DateTime.Parse(endtime))
+ });
+ }
+ catch (Exception ex)
{
- MessageBox.Show(errMsg, "错误", MessageBoxButton.OKCancel, MessageBoxImage.Error);
+ MessageBox.Show(ex.Message, "错误", MessageBoxButton.OKCancel, MessageBoxImage.Error);
Environment.Exit(0);
- return;
}
- LiveClassroom.EnterTheClassroom(Window.GetWindow(this),
- new TRTC.Models.ClassroomEntity
- {
- ClassHead = classHead,
- ClassSubHead = classSubHead,
- TeacherId = teacherId,
- TeacherName = teacherName,
- EndTime = string.IsNullOrEmpty(endtime) ? null : new DateTime?(DateTime.Parse(Encoding.UTF8.GetString(Convert.FromBase64String(endtime))))
- });
}
}
}
diff --git a/JianGongYun/lg.ico b/JianGongYun/lg.ico
new file mode 100644
index 0000000..cf27d13
Binary files /dev/null and b/JianGongYun/lg.ico differ