Пример #1
0
        public ServiceSettingsView(PluginInstance servicePlugin)
        {
            this.servicePlugin = servicePlugin;
            service            = servicePlugin.Service;
            authenticatable    = service.AsAuthenticatable();
            if (authenticatable == null)
            {
                throw new ArgumentException("Service instance passed must implement IAuthenticatable", nameof(service));
            }
            InitializeComponent();
            sspSignInStatus = new SplitStringParser(signInStatusLabel);
            sspSignInButton = new SplitStringParser(signInButton);
            if (authenticatable.IsAuthenticated)
            {
                signInStatusLabel.Text = String.Format(sspSignInStatus.Get(authenticatable.IsAuthenticated),
                                                       LocalisableAccountNameFormat.GetFormattedName(authenticatable.Account));
            }
            else
            {
                sspSignInStatus.Update(false);
            }
            sspSignInButton.Update(authenticatable.IsAuthenticated);
            var control = service.GetSettingsControl();

            control.Dock = DockStyle.Fill;
            servicePanel.Controls.Add(control);
        }
Пример #2
0
 public ServiceSettingsView(PluginInstance servicePlugin)
 {
     this.servicePlugin = servicePlugin;
     service            = servicePlugin.Service;
     authenticatable    = service.AsAuthenticatable();
     InitializeComponent();
     if (authenticatable == null)
     {
         authPanel.Visible = false;
     }
     else
     {
         UpdateViews();
     }
     try
     {
         var control = service.GetSettingsControl();
         control.Dock = DockStyle.Fill;
         servicePanel.Controls.Add(control);
     }
     catch (Exception ex)
     {
         Log.WriteException(Level.Error, Lag, ex, "service.GetSettingsControl()");
         var text  = "An error occurred while trying to display the service's settings panel.\n\n" + ex;
         var label = new Label
         {
             AutoSize = false,
             Dock     = DockStyle.Fill,
             Padding  = new Padding(10),
             Text     = text
         };
         servicePanel.Controls.Add(label);
     }
 }
Пример #3
0
        public bool SignIn(IAuthenticatable authenticatable, string password)
        {
            bool userAuthenticated = authenticatable.Authenticate(password);

            if (userAuthenticated)
            {
                Console.WriteLine("Welcome to System");
                return(true);
            }
            else
            {
                Console.WriteLine("Incorrect Password");
                return(false);
            }
        }
        void OnDisable()
        {
            authBackend = null;
            if (m_Interop != null)
            {
                m_Interop.OnDisable();
                m_Interop = null;
            }
            if (m_StartGetUserInfo != null)
            {
                StopCoroutine(m_StartGetUserInfo);
            }
            m_UnityUserTask = null;

            ProjectServer.Cleanup();
        }
Пример #5
0
        public ServiceSettingsView(PluginInstance servicePlugin)
        {
            this.servicePlugin = servicePlugin;
            service            = servicePlugin.Service;
            authenticatable    = service.AsAuthenticatable();
            InitializeComponent();
            if (authenticatable == null)
            {
                authPanel.Visible = false;
            }
            else
            {
                UpdateLabels();
            }
            var control = service.GetSettingsControl();

            control.Dock = DockStyle.Fill;
            servicePanel.Controls.Add(control);
        }
        void Awake()
        {
            // Called as soon as we can
            SetupProxy();

            if (tokenUpdated == null)
            {
                tokenUpdated = new TokenEvent();
            }
            if (authenticationFailed == null)
            {
                authenticationFailed = new FailureEvent();
            }
            if (userLoggedIn == null)
            {
                userLoggedIn = new UnityUserUnityEvent();
            }
            if (userLoggedOut == null)
            {
                userLoggedOut = new UnityEvent();
            }
            if (linkSharingDetected == null)
            {
                linkSharingDetected = new LinkSharingEvent();
            }
            if (openInViewerDetected == null)
            {
                openInViewerDetected = new OpenInViewerEvent();
            }

            ProjectServer.Init();

            authBackend = new AuthBackend(this);
#if UNITY_STANDALONE_WIN && !UNITY_EDITOR
            m_Interop = new Interop(this);
            m_Interop.Start();
#endif

            m_TokenPersistentPath = Path.Combine(Application.persistentDataPath, AuthConfiguration.JwtTokenFileName);
        }