Example #1
0
        protected void OnLoginFailed(UFEPacket resp)
        {
            //Cursor = Cursors.Default;
            Result           = false;
            lblError.Visible = true;
            if (IsTreeList)
            {
                ControlService.DashboardTree.Cursor = Cursors.Default;
                ControlService.DashboardTree.DashboardTreeList.Cursor = Cursors.Default;
            }
            //CloseConnection();

            if (IsCancel)
            {
                return;
            }
            const string ftpError = "Auth fail";

            if (resp.ActionError.Message.Contains(ftpError))
            {
                lblError.Text = "SSH server auth fail. Disconnect the connection.";
                //MsgBox.Warning("SSH server auth fail. Disconnect the connection.");
            }
            else
            {
                string msg = " Please try again.";
                if (resp.ActionError.Message.Contains("logged"))
                {
                    msg = " Please try again later.";
                }
                lblError.Text = resp.ActionError.Message + msg;

                //MsgBox.Warning(resp.ActionError.Message + msg);
            }
        }
        protected override void HandleResponseSuccess(UFEPacket resp)
        {
            var      sign     = Controller.Sign as SignInfo;
            string   signInfo = resp.Content.GetProperty <string>("Info");
            int      height   = resp.Content.GetProperty <int>("Hight");
            int      width    = resp.Content.GetProperty <int>("Width");
            SignType signType = EnumHelper.Parse <SignType>(resp.Content.GetProperty <int>("Type"));

            //sign.Height = 10000;
            //sign.Width = 10000;
            //LocalMessageBus.Send(this, new DataChangedMessage(PWDataType.Dashboard));
            //LocalMessageBus.Send(this, new ActiveChange(sign, false));

            sign.Height = height;
            //sign.SignInfomation = signInfo + "  :  " + height.ToString() + " x " + width.ToString() + "  :  " + signType.ToString();
            sign.SignInfomation         = height.ToString() + " x " + width.ToString();
            sign.Width                  = width;
            sign.Type                   = signType;
            sign.Template.Sign.Width    = width;
            sign.Template.Sign.Height   = height;
            sign.Template.Sign.SignType = signType;
            var message = sign.Template.Message;

            message.ImageLayer.Height       = message.ImageLayer.FitToSign ? sign.Height : sign.Height / 2;
            message.ImageLayer.Width        = message.ImageLayer.FitToSign ? sign.Width : sign.Width / 2;
            message.VideoLayer.Height       = message.VideoLayer.FitToSign ? sign.Height : sign.Height / 2;
            message.VideoLayer.Width        = message.VideoLayer.FitToSign ? sign.Width : sign.Width / 2;
            message.TextLayer.Height        = message.TextLayer.FitToSign ? sign.Height : sign.Height / 2;
            message.TextLayer.Width         = message.TextLayer.FitToSign ? sign.Width : sign.Width / 2;
            message.DynamicTextLayer.Height = message.DynamicTextLayer.FitToSign ? sign.Height : sign.Height / 2;
            message.DynamicTextLayer.Width  = message.DynamicTextLayer.FitToSign ? sign.Width : sign.Width / 2;
            sign.Type = signType;

            ActionHelper.OnConnected();
        }
Example #3
0
        protected override void HandleResponseSuccess(UFEPacket resp)
        {
            var fileList = resp.Content.GetProperty <object[]>("FileList");

            if (fileList != null && fileList.Length > 0)
            {
                List <ServerLibraryItem> libraries = new List <ServerLibraryItem>();

                foreach (var o in fileList)
                {
                    var item = serializer.ConvertToType <UfeFile>(o);
                    var type = ConvertLibraryType(item.Type);


                    libraries.Add(new ServerLibraryItem
                    {
                        Id         = item.Id,
                        Name       = item.Name,
                        Length     = item.Length,
                        Type       = type,
                        CreateTime = item.CreateTime,
                        ModifyTime = item.ModifyTime,
                    });
                }
                Controller.Connection.ServerLibraries = libraries;
                //Controller.Connection.ServerLibraries = libraries;
            }


            base.HandleResponseSuccess(resp);
        }
        /// <summary>
        /// Login failed
        /// </summary>
        /// <param name="resp"></param>
        protected void OnLoginFailed(UFEPacket resp)
        {
            Cursor = Cursors.Default;
            //CloseConnection();
            Action successCallback = null;
            Action failCallback    = null;
            var    action          = new LogoffAction(Current, successCallback, failCallback, false);

            action.Perform();

            const string ftpError = "Auth fail";

            if (resp.ActionError.Message.Contains(ftpError))
            {
                MsgBox.Warning("SSH server auth fail. Disconnect the connection.");
                Close();
            }
            else
            {
                string msg = " Please try again.";
                if (resp.ActionError.Message.Contains("logged"))
                {
                    msg = " Please try again later.";
                }
                MsgBox.Warning(resp.ActionError.Message + msg);
            }
        }
Example #5
0
        public override void Perform(UFEPacket resp)
        {
            IsCurrentUser = false;
            //Controller.Connection.Locked = false;
            Controller.Connection.CanLock = false;

            int userId = resp.Content.GetProperty <int>("OwnerId");

            IsCurrentUser
                = userId == Controller.Connection.User.Id;

            //Controller.Connection.Locked = IsCurrentUser;

            var user = Controller.Connection.User;

            if (user.IsFtpRole)
            {
                Controller.Connection.CanLock = !IsCurrentUser;
            }

            base.Perform(resp);

            if (IsCurrentUser)
            {
                SetMenuItems(true);
            }
        }
Example #6
0
 protected override void HandleResponseSuccess(UFEPacket resp)
 {
     if (Controller != null)
     {
         Controller.Connection.Users = serializer.ConvertToType <List <User> >(resp.Content);
     }
     base.HandleResponseSuccess(resp);
 }
Example #7
0
        protected override void HandleResponseSuccess(UFEPacket resp)
        {
            var result = serializer.ConvertToType <User>(resp.Content);

            if (result != null)
            {
                Controller.Connection.Users.Add(result);
            }
        }
Example #8
0
        void OnChangePasswordSuccessed(UFEPacket resp)
        {
            int lockUserId    = resp.Content.GetProperty <int>("OwnerId");
            int currentUserId = resp.UserId;

            if (lockUserId == currentUserId)
            {
                MsgBox.Warning("Set password successed!");
            }
        }
Example #9
0
        protected override void HandleResponseSuccess(UFEPacket resp)
        {
            var id   = serializer.ConvertToType <int>(resp.Content);
            var user = Controller.Connection.Users.Find(p => { return(p.Id == id); });

            if (user != null)
            {
                Controller.Connection.Users.Remove(user);
            }
        }
Example #10
0
        protected override void HandleResponseSuccess(UFEPacket resp)
        {
            var result = serializer.ConvertToType <User>(resp.Content);

            if (result != null)
            {
                var user = Controller.Connection.Users.Find(p => { return(p.Id == result.Id); });
                if (user != null)
                {
                    user.Role = result.Role;
                }
            }
        }
        protected override void HandleResponseSuccess(UFEPacket resp)
        {
            if (resp.Content != null)
            {
                var id  = resp.Content.GetProperty <int>("UserId");
                var pwd = resp.Content.GetProperty <string>("Password");

                var user = Controller.Connection.Users.Find(p => { return(p.Id == id); });
                if (user != null)
                {
                    user.NoSecurityPWD = pwd;
                }
            }
        }
Example #12
0
        protected void OnLoginFailed(UFEPacket resp)
        {
            Cursor = Cursors.Default;
            const string ftpError = "Auth fail";

            if (resp.ActionError.Message.Contains(ftpError))
            {
                MsgBox.Warning("SSH server auth fail. Disconnect the connection.");
            }
            else
            {
                MsgBox.Warning(resp.ActionError.Message + " Please try again.");
            }
        }
Example #13
0
        protected override void HandleResponseSuccess(UFEPacket resp)
        {
            Controller.Connection.User.Status = UserStatus.Online;
            Controller.Connection.User.Id     = resp.UserId;
            Controller.Connection.User.Role   = resp.Role;



            LoginResponseBody body = serializer.ConvertToType <LoginResponseBody>(resp.Content);

            if (body != null)
            {
                Controller.Connection.Users           = body.Users;
                Controller.Connection.ServerLibraries = body.Libraries;
            }
            body = null;

            ActionHelper.OnAfterLogin(Controller.Connection.User);
        }
Example #14
0
        private void HandleResponseSuccess1(UFEPacket resp)
        {
            var fileList = resp.Content.GetProperty <object[]>("FileList");

            if (fileList != null && fileList.Length > 0)
            {
                List <ServerLibraryItem> libraries = Controller.Connection.ServerLibraries;
                if (libraries == null)
                {
                    libraries = new List <ServerLibraryItem>();
                }

                foreach (var o in fileList)
                {
                    var item = serializer.ConvertToType <UfeFile>(o);
                    var type = ConvertLibraryType(item.Type);
                    if (type != ServerLibraryType.None)
                    {
                        if (item.IsUpdate)
                        {
                            var old = libraries.Find(p => { return(p.Id == item.Id); });
                            if (old != null)
                            {
                                libraries.Remove(old);
                            }
                        }

                        libraries.Add(new ServerLibraryItem
                        {
                            Id         = item.Id,
                            Name       = item.Name,
                            Length     = item.Length,
                            Type       = type,
                            CreateTime = item.CreateTime,
                            ModifyTime = item.ModifyTime,
                        });
                    }
                }
            }


            base.HandleResponseSuccess(resp);
        }
Example #15
0
 protected override void HandleResponseSuccess(UFEPacket resp)
 {
     OnHandle();
 }
Example #16
0
 protected override void HandleResponseFail(UFEPacket resp)
 {
     OnHandle();
 }
Example #17
0
        //protected void CloseConnection()
        //{
        //    var controller = ControlService.SignCombo.Current.Controller;
        //    if (controller.Connection.State == System.Communication.ConnectionState.Closed)
        //        return;

        //    if (controller.Connection.User.Status != UserStatus.Online)
        //    {
        //        controller.Connection.Close();
        //        while (controller.Connection.State != System.Communication.ConnectionState.Closed)
        //            System.Threading.Thread.Sleep(50);

        //    }
        //}

        protected virtual void OnLoginSuccessed(UFEPacket resp)
        {
            Cursor = Cursors.Default;
            Close();
        }
Example #18
0
 void OnUserChanged(UFEPacket resp)
 {
     InitGrid();
 }