public ServerConfigDialog(BaseServer server, Action<bool> actionComplete)
        {
            InitializeComponent();

            Preference preference = SettingManager.Appearance;
            Left = preference.WindowServerConfig.X;
            Top = preference.WindowServerConfig.Y;

            if (server is Model.SS.Shadowsocks)
            {
                Title = (string)Application.Current.FindResource("dialog_server_shadowsocks");
            }
            else if (server is Model.V2Ray.V2RayVMess)
            {
                Title = (string)Application.Current.FindResource("dialog_server_v2ray");
            }
            else
            {
                throw new ArgumentException(System.Reflection.MethodBase.GetCurrentMethod().Name);
            }

            // set viewmodel
            DataContext = new ServerConfigVModel(server, actionComplete);
            Closing += Window_Closing;
        }
Example #2
0
        public DialogServerConfig(ServerProfile serverProfile)
        {
            InitializeComponent();

            Preference preference = App.GlobalPreference;

            Left = preference.WindowServerConfig.X;
            Top  = preference.WindowServerConfig.Y;

            // set viewmodel
            DataContext = new ServerConfigVModel(new ServerProfileView(serverProfile));
            Closing    += Window_Closing;
        }