Ejemplo n.º 1
0
 public void ChangeMachineName(string newName, string oldName)
 {
     if (newName == oldName)
     {
         return;
     }
     ///
     if (string.IsNullOrEmpty(newName))
     {
         ErrorDialogCon errorcon = new ErrorDialogCon();
         errorcon.ErrorMsg = "名称不能为空";
         errorcon.PopupDialog();
         return;
     }
     ///
     if (MachineLogic.ChangeMachineName(MachineLogic.localMachine().machineId, newName) == false)
     {
         ErrorDialogCon errorcon = new ErrorDialogCon();
         errorcon.ErrorMsg = "更新名称错误";
         errorcon.PopupDialog();
         return;
     }
     ///
     foreach (var m in myMachines)
     {
         WebSocketClient.SendMessage(m.machineId, newName, msgType.client_onNameChange);
     }
 }
Ejemplo n.º 2
0
        private void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                var machineInfo    = MachineLogic.localMachine();
                var netmachineInfo = UserLogic.AutoLogin(machineInfo.token);
                if (netmachineInfo == null)
                {
                    NavigationHelper.NavigatedToView("用户登录");
                }
                if (netmachineInfo.machineId != machineInfo.machineId)
                {
                    NavigationHelper.NavigatedToView("用户登录");
                }
                machineInfo.machineName = netmachineInfo.machineName;
                machineInfo.machinepwd  = netmachineInfo.machinePwd;
                MachineLogic.RecordMachineInfo(machineInfo);
                NavigationHelper.NavigatedToView("主界面");
            }
            catch (Exception)
            {
                NavigationHelper.NavigatedToView("用户登录");
            }

            var Swatches = new SwatchesProvider().Swatches;
            var swatch   = Swatches.FirstOrDefault(o => o.Name == "blue");

            ModifyTheme(theme =>
            {
                theme.SetBaseTheme(Theme.Light);
            });
            ModifyTheme(theme => theme.SetPrimaryColor(swatch.ExemplarHue.Color));
            ModifyTheme(theme => theme.SetSecondaryColor(swatch.AccentExemplarHue.Color));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 接收到对方的Candidate,进行处理
        /// </summary>
        /// <param name="candidate"></param>
        public void AddRemoteCandidate(string mchineId, IceCandidate iceCandidate)
        {
            var ice = JsonConvert.SerializeObject(iceCandidate);

            if (mchineId == MachineLogic.localMachine().machineId)
            {
                return;
            }
            this.PeerConnection.AddCandidate(iceCandidate);
        }
Ejemplo n.º 4
0
 public void loginMethod(object param)
 {
     if (UserLogic.Login(this.userName, pwd, Environment.MachineName))
     {
         var machineInfo = MachineLogic.localMachine();
         var msg         = "登录成功,机器ID:" + machineInfo.machineId + ",机器密码:" + machineInfo.machinepwd;
         this.ShowMessageBoxSuccess(msg, "成功", System.Windows.MessageBoxButton.OK);
         NavigationHelper.NavigatedToView("主界面");
     }
 }
Ejemplo n.º 5
0
 public void loginMethod(object param)
 {
     if (UserLogic.Login(this.userName, pwd, Environment.MachineName))
     {
         var            machineInfo = MachineLogic.localMachine();
         ErrorDialogCon con         = new ErrorDialogCon();
         con.ErrorMsg = "登录成功,机器ID:" + machineInfo.machineId + ",机器密码:" + machineInfo.machinepwd;
         //show the dialog
         con.PopupDialog();
         NavigationHelper.NavigatedToView("主界面");
     }
 }
Ejemplo n.º 6
0
 protected RemoteControlBase()
 {
     this.Id                = Guid.NewGuid();
     this.config            = new WebRtcConfig();
     this.config.iceServers = new List <iceServer>();
     this.config.iceServers.Add(new iceServer
     {
         url        = "turn:" + ServerAddrs.lylRtcServerAddr + "?transport=udp",
         username   = MachineLogic.localMachine().machineId,
         credential = MachineLogic.localMachine().machineId,
     });
     this.config.iceTransportPolicy = iceTransportPolicyType.kRelay;
     PeerConnection.RegisterIceServer(this.config);
 }
Ejemplo n.º 7
0
        private void ChangeMachineNameButton_OnClick(object sender, RoutedEventArgs e)
        {
            ChangeMachineNameCon popup = new ChangeMachineNameCon(MachineLogic.localMachine().machineName);

            popup.PopupDialog(closingEventHandler: this.onChangeMachineNamePopupClosed);
        }