using ESBasic.Loggers;
using OMCS.Communication.Plus.Serialization;
using OMCS.Passive;
using OVCS.ClientWpf.Tools;
using System.Windows;

namespace OVCS.ClientWpf
{
    /*
     * OVCS采用的是ESFramework通信框架和OMCS网络语音视频框架的免费版本，若想获取其它版本，请联系www.oraycn.com。
     * 
     */
    public partial class App : Application
    {
        internal static string ServerID = "_0";
        public static IAgileLogger TestLogger = new FileAgileLogger("TestLog.txt"); 
        // OMCS 多媒体设备管理器
        private static IMultimediaManager multimediaManager = MultimediaManagerFactory.GetSingleton();
        public static MainWindow MainWindow;
        
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            System.Threading.ThreadPool.SetMinThreads(50, 12);
            
            
            CompactPropertySerializer.SetDefault(new ExtenseCompactPropertySerializer());
            
            CommonHelper.LoadImageSource(); 


            Oraycn.MFile.GlobalUtil.SetAuthorizedUser("FreeUser", "");

            LoginWindow loginWindow = new LoginWindow(multimediaManager);
            loginWindow.Show();
            loginWindow.loginSuccess += LoginWindow_loginSuccess;
        }

        private void LoginWindow_loginSuccess(string roomID)
        {           
            MainWindow = new MainWindow(roomID,  multimediaManager);
            MainWindow.Show();
        }
    }
}
