예제 #1
0
        public MainForm()
        {
            _settings = ExtruderSettings.GetAppSettings();
            _encryptor = new TripleDesStringEncryptor();

            InitializeComponent();

            DeviceConnectedOrDisconnected();
            RefreshConnectText(ConnectionState.Disconnected);

            InitializeSettingsPage();
            InitializePages();

            SubscribeEvents();
        }
예제 #2
0
        public void EnsureConnected(ExtruderSettings settings)
        {
            if (_isInitialized) return;
            _isInitialized = true;

            _settings = settings;
            string credentialsAsString = string.Format("username={0}&encryptedpassword={1}&extruderName={2}", 
                WebUtility.UrlEncode(settings.UserName), 
                WebUtility.UrlEncode(settings.EncryptedPassword),
                WebUtility.UrlEncode(settings.MyName));
            var asciiEncoding = new ASCIIEncoding();
            byte[] credentials = asciiEncoding.GetBytes(credentialsAsString);

            string url = SosOnlineService.SOS_URL + "/Mobile/App";
            _webBrowser.Navigate(url, null, credentials, "Content-Type: application/x-www-form-urlencoded");
            _webBrowser.Url = new Uri(url);
        }