예제 #1
0
        protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
        {
            bool IsExit = false;

            if ((keyData & Keys.KeyCode) == Keys.F1)
            {
                InputBoxResult test = InputBox.Show("Please Enter Password..", "Sales System", "");
                if (test.ReturnCode == DialogResult.OK)
                {
                    if (test.Text == "HG54E-87FDW-12DCF-76WQA-67HGF")
                    {
                        pnl2.Visible = true;
                    }
                    else
                    {
                        pnl2.Visible = false;
                        XtraMessageBox.Show("You are not permitted for this option.");
                    }
                }
                return(IsExit);
            }
            else if ((keyData & Keys.KeyCode) == Keys.F2)
            {
                pnl2.Visible = false;
                return(IsExit);
            }
            else
            {
                return(base.ProcessCmdKey(ref msg, keyData));
            }
        }
예제 #2
0
        private void btnWriteOEMInfo_Click(object sender, EventArgs e)
        {
            this.Enabled = false;

            InputBoxResult result = InputBox.Show("Test prompt:", "Some title", "Default text", null);

            if (result.OK)
            {
                Console.WriteLine("read string " + result.Text);
            }

            // create dummy OEM-info for testing...
            byte[] OEMInfo = new byte[4];
            for (int i = 0; i < 4; i++)
            {
                if (i >= result.Text.Length)
                {
                    OEMInfo[i] = 0;
                }
                else
                {
                    OEMInfo[i] = (byte)result.Text.ToCharArray()[i];
                }
            }
            //byte[] OEMInfo = { 0x01, 0x02, 0x03, 0x04 };

            // write the OEM-information (4 bytes) and check for error
            if (Handset.WriteOEMInformation(OEMInfo) < 0)
            {
                MessageBox.Show("Could not write OEM-Information!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }

            this.Enabled = true;
        }
예제 #3
0
        /// <summary>
        /// Displays a prompt in a dialog box, waits for the user to input text or click a button.
        /// </summary>
        /// <param name="prompt">String expression displayed as the message in the dialog box</param>
        /// <param name="title">String expression displayed in the title bar of the dialog box</param>
        /// <param name="defaultResponse">String expression displayed in the text box as the default response</param>
        /// <param name="validator">Delegate used to validate the text</param>
        /// <param name="keyPressHandler">Delete used to handle keypress events of the textbox</param>
        /// <param name="xpos">Numeric expression that specifies the distance of the left edge of the dialog box from the left edge of the screen.</param>
        /// <param name="ypos">Numeric expression that specifies the distance of the upper edge of the dialog box from the top of the screen</param>
        /// <returns>An InputBoxResult object with the Text and the OK property set to true when OK was clicked.</returns>
        public static InputBoxResult Show(string prompt, string title, string defaultResponse, InputBoxValidatingHandler validator, KeyPressEventHandler keyPressHandler, int xpos, int ypos)
        {
            using (InputBox form = new InputBox())
            {
                form.label.Text   = prompt;
                form.Text         = title;
                form.textBox.Text = defaultResponse;
                if (xpos >= 0 && ypos >= 0)
                {
                    form.StartPosition = FormStartPosition.Manual;
                    form.Left          = xpos;
                    form.Top           = ypos;
                }

                form.Validator  = validator;
                form.KeyPressed = keyPressHandler;

                DialogResult result = form.ShowDialog();

                InputBoxResult retval = new InputBoxResult();
                if (result == DialogResult.OK)
                {
                    retval.Text = form.textBox.Text;
                    retval.OK   = true;
                }

                return(retval);
            }
        }
예제 #4
0
		private void btnJoinPrivateRoom_Click(object sender, EventArgs e)
		{
			InputBoxResult result = InputBox.Show("Room name:", "Enter room name", "", null);

			if (result == null)
				return;

			InputBoxResult result2 = InputBox.Show("Password:"******"Enter Password", "", null);

			if (result2 == null)
				return;

			string password = result2.Text.Trim();

			if (result.OK)
			{
				if (result.Text.Trim() != "")
					//Use JoinConferenceRoom to join a private room
					// if the room does not exist it gets created.
					// If the room already exist, you will join it
					// and the UserJoinedConference event will be fired
					// for each user that is presnet in the room

					ics.JoinConferenceRoom(result.Text, password);
			}
		}
예제 #5
0
        /// <summary>
        /// Displays a prompt in a dialog box, waits for the user to input text or click a button.
        /// </summary>
        /// <param name="prompt">String expression displayed as the message in the dialog box</param>
        /// <param name="title">String expression displayed in the title bar of the dialog box</param>
        /// <param name="defaultResponse">String expression displayed in the text box as the default response</param>
        /// <param name="validator">Delegate used to validate the text</param>
        /// <param name="keyPressHandler">Delete used to handle keypress events of the textbox</param>
        /// <param name="xpos">Numeric expression that specifies the distance of the left edge of the dialog box from the left edge of the screen.</param>
        /// <param name="ypos">Numeric expression that specifies the distance of the upper edge of the dialog box from the top of the screen</param>
        /// <returns>An InputBoxResult object with the Text and the OK property set to true when OK was clicked.</returns>
        public static InputBoxResult Show(string prompt, string title, string defaultResponse, InputBoxValidatingHandler validator, KeyPressEventHandler keyPressHandler, int xpos, int ypos)
        {
            using (InputBox form = new InputBox())
            {
                form.label.Text = prompt;
                form.Text = title;
                form.textBox.Text = defaultResponse;
                if (xpos >= 0 && ypos >= 0)
                {
                    form.StartPosition = FormStartPosition.Manual;
                    form.Left = xpos;
                    form.Top = ypos;
                }

                form.Validator = validator;
                form.KeyPressed = keyPressHandler;

                DialogResult result = form.ShowDialog();

                InputBoxResult retval = new InputBoxResult();
                if (result == DialogResult.OK)
                {
                    retval.Text = form.textBox.Text;
                    retval.OK = true;
                }

                return retval;
            }
        }
예제 #6
0
        private void btnOption_Click(object sender, EventArgs e)
        {
            InputBoxResult test = InputBox.Show("Please Enter Password..", "Easy Queue", "");

            if (test.ReturnCode == DialogResult.OK)
            {
                if (test.Text == "HG54E-87FDW-12DCF-76WQA-67HGF")
                {
                    if (this.Height == 225)
                    {
                        this.Height  = 335;
                        pnl2.Visible = true;
                    }
                    else
                    {
                        this.Height  = 225;
                        pnl2.Visible = false;
                    }
                }
                else
                {
                    bllUtility.MyMessage("You are not permitted for this option.");
                }
            }
        }
        private void lnkAddNewKey_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            try
            {
                InputBoxResult rs = InputBox.Show("Nombre de la Key");
                if (rs.ReturnCode == DialogResult.OK)
                {
                    if (!string.IsNullOrEmpty(rs.Text))
                    {
                        List <string> values = new List <string>();
                        values.Add(rs.Text);
                        foreach (config.AppConfig cfg in _app_configs)
                        {
                            values.Add("");
                        }
                        ListViewItem item = new ListViewItem(values.ToArray());

                        lstAppSettingsKEYS.Items.Add(item);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "Error al añadir key", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #8
0
 private void renameTN_Click(object sender, EventArgs e)
 {
     while (true)
     {
         InputBoxResult result = InputBox.Show("New Team Name", "Team Name", "e.g. companyTeam1", null);
         if (result.Text != "")
         {
             MySqlConnection conn = makeConnection();
             string          checkNotiTypeQuery  = "SELECT COUNT(*) FROM `webEditUsers` WHERE teamCode='" + teamcode + "' AND `notificationType` IS NULL";
             MySqlCommand    checkNotiType       = new MySqlCommand(checkNotiTypeQuery, conn);
             string          checkNotiTypeResult = checkNotiType.ExecuteScalar().ToString();
             if (checkNotiTypeResult != "0")
             {
                 //if not just set as normal
                 string       updateNotiQuery = "UPDATE webEditUsers SET notificationType = 'newTN', notification='The user: "******" wants to change the the Team Name to " + result.Text + ";" + result.Text + "' WHERE teamCode='" + teamcode + "' ";
                 MySqlCommand updateNoti      = new MySqlCommand(updateNotiQuery, conn);
                 updateNoti.ExecuteNonQuery();
             }
             else
             {
                 //if so add new after previous with [,] as the definer to make easier later to get the notifications
                 string       updateNotiQuery = "UPDATE webEditUsers SET notificationType = concat(notificationType, ', newTN'), notification = concat(notification, ', The user: "******" wants to change the the Team Name to " + result.Text + ";" + result.Text + "') WHERE teamCode='" + teamcode + "' ";
                 MySqlCommand updateNoti      = new MySqlCommand(updateNotiQuery, conn);
                 updateNoti.ExecuteNonQuery();
             }
             break;
         }
     }
 }
예제 #9
0
 private void btnEditSection_Click(object sender, EventArgs e)
 {
     if (null != lstSection.SelectedItem)
     {
         Section        section = (Section)lstSection.SelectedItem;
         InputBoxResult result  = InputBox.Show("Name:", "Edit section", section.UnicodeName, new InputBoxValidatingHandler(Validate_EditSection));
     }
 }
예제 #10
0
 private InputBox(dialogForm dialog)
 {
     result = dialog.InputResult;
     items  = new Dictionary <string, string>();
     for (int i = 0; i < dialog.label.Length; i++)
     {
         items.Add(dialog.label[i].Text, dialog.textBox[i].Text);
     }
 }
예제 #11
0
        private void fileToolStripMenuItem_Click(object sender, EventArgs e)
        {
            InputBoxResult box = InputBox.Show("Tên tập tin", "Điền tên tập tin.");

            if (box.ReturnCode == DialogResult.OK)
            {
                hostInstance.Create(path + box.Text);
            }
        }
예제 #12
0
        private void fodderToolStripMenuItem_Click(object sender, EventArgs e)
        {
            InputBoxResult box = InputBox.Show("Tạo thư mục mới", "Điền tên thư mục.");

            if (box.ReturnCode == DialogResult.OK)
            {
                hostInstance.CreateFolder(path + box.Text);
            }
        }
예제 #13
0
        private void 凍結左邊欄位ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            InputBoxResult result = InputBox.Show("輸入左邊凍結欄位數目:", "凍結欄位", "0", new InputBoxValidatingHandler(inputBox_Validating));

            if (result.OK)
            {
                int cnt = int.Parse(result.Text);
                FrozenLeftColumns(cnt, true);
            }
        }
예제 #14
0
		private void btnChangeStatusMessage_Click(object sender, EventArgs e)
		{
			InputBoxResult result = InputBox.Show("Status message ?", "Enter status message", "", null);

			if (result == null)
				return;

			if (result.OK)
				ics.SetStatusMessage(result.Text);
		}
예제 #15
0
        private void renameToolStripMenuItem_Click_1(object sender, EventArgs e)
        {
            InputBoxResult rename = InputBox.Show("Nhập tên tập tin mới", "Đổi tên " + selected.Item.Text, selected.Item.Text);

            if (rename.ReturnCode == DialogResult.OK)
            {
                if (rename.Text != string.Empty)
                {
                    hostInstance.Rename(path + selected.Item.Text, path + rename.Text);
                }
            }
        }
예제 #16
0
        private void btnAddMod_Click(object sender, EventArgs e)
        {
            var            newGCM = string.Empty;
            InputBoxResult result = InputBox.Show("Enter the modifier you wish to add.", "Add Modifier", "Enter the modifier here", InputBox.InputBoxIcon.Info, inputBox_Validating);

            if (result.OK)
            {
                newGCM = result.Text;
            }
            DatabaseAPI.Database.EffectIds.Add(newGCM);
            lvModifiers.Items.Add(newGCM);
        }
예제 #17
0
        public static string GetString(string title, string promt, Window owner = null)
        {
            var result = new InputBoxResult();

            new InputBoxWindow.InputBoxWindow
            {
                DataContext = new InputBoxViewModel(title, promt, result),
                Owner       = owner ?? Application.Current.MainWindow,
            }
            .ShowDialog();

            return(result.Result);
        }
예제 #18
0
 public static void SendMessageToSession(Session session)
 {
     if (session != null)
     {
         string         prompt = Resources.Pleaseenterthemessagetosend;
         InputBoxResult result = InputBox.Show(prompt, "Send network message");
         if (result.ReturnCode == DialogResult.OK && !string.IsNullOrEmpty(result.Text))
         {
             string meessageText  = result.Text.Trim();
             string messageHeader = Resources.MessagefromyourAdministrator;
             TerminalServicesAPI.SendMessage(session, messageHeader, meessageText, 0, 10, false);
         }
     }
 }
예제 #19
0
        private void EnviarEmail(string aNomeArquivo)
        {
            if (ckbEmailPDF.Checked == true)
            {
                InputBoxResult Destino = InputBox.Show("Envio de Email", "Informe o email destinatário", "*****@*****.**", null);

                if ((Destino.OK) && (Destino.Text != ""))
                {
                    string EmailDestinatario = Destino.Text;
                    if (NFSe.EnviarEmail(EmailDestinatario, aNomeArquivo))
                    {
                        MessageBox.Show("Email enviado com sucesso.");
                    }
                }
            }
        }
예제 #20
0
        public InputBoxViewModel(string title, string promt, InputBoxResult result)
        {
            this.Title = title;
            this.Promt = promt;

            ConfirmInput = new Command(() =>
            {
                result.Result = input;
                CloseDialog();
            });

            Abort = new Command(() =>
            {
                result.Result = null;
                CloseDialog();
            });
        }
예제 #21
0
 private void lnkAddNewKey_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
 {
     try
     {
         InputBoxResult rs = InputBox.Show("Nombre de la Key");
         if (rs.ReturnCode == DialogResult.OK)
         {
             if (!string.IsNullOrEmpty(rs.Text))
             {
                 ListViewItem item = new ListViewItem(new string[] { rs.Text, "" });
                 lstAppSettingsKEYS.Items.Add(item);
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString(), "Error al añadir key", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
예제 #22
0
        private bool PedirParametrosExtras(ref string aParametrosExtras)
        {
            bool Result = true;

            if (ckbModoAvancado.Checked)
            {
                InputBoxResult Extras = InputBox.Show("Informe os parâmetros extras separados por ponto-e-vírgula, caso sejam necessários. " + (char)13 +
                                                      "Em caso contrário, apenas clique em OK.", "Informe os parâmetros extras:", "", null);
                if (Extras.OK)
                {
                    aParametrosExtras = Extras.Text;
                }
                else
                {
                    Result = false;
                }
            }
            return(Result);
        }
예제 #23
0
            public InputBoxResult Show()
            {
                string         text   = string.Empty;
                InputBoxResult result = InputBoxResult.Cancel;
                InputBoxGUI    gui    = new();

                void ResultOK(object a, EventArgs b)
                {
                    if (string.IsNullOrWhiteSpace(gui.Input.Text))
                    {
                        MessageBox.Show("Please input something", "", MessageBoxButton.OK, MessageBoxImage.Error);
                    }

                    else if (Func.CheckForIllegalCharacter(gui.Input.Text))
                    {
                        MessageBox.Show("Text contains illegal characters", "", MessageBoxButton.OK, MessageBoxImage.Error);
                    }

                    else
                    {
                        result = InputBoxResult.OK;
                        text   = gui.Input.Text;
                        gui.Close();
                    }
                }

                void ResultCancel(object a, EventArgs b)
                {
                    result = InputBoxResult.Cancel;
                    gui.Close();
                }

                gui.LabelTitle.Content = Title;
                gui.CloseButton.Click += ResultCancel;
                gui.OK.Click          += ResultOK;
                gui.Cancel.Click      += ResultCancel;

                gui.ShowDialog();

                Text = text;
                return(result);
            }
예제 #24
0
 private void newFolderToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (this.treeViewFolders.SelectedNode != null)
     {
         DirectoryInfo  dir    = (this.treeViewFolders.SelectedNode.Tag as DirectoryInfo);
         InputBoxResult result = InputBox.Show("Enter folder Name:", "Create new folder");
         if (result.ReturnCode == DialogResult.OK)
         {
             string rootFolder  = dir.FullName;
             string fullNewName = Path.Combine(rootFolder, result.Text);
             if (!Directory.Exists(fullNewName))
             {
                 DirectoryInfo info = Directory.CreateDirectory(fullNewName);
                 TreeNode      node = new TreeNode(result.Text);
                 node.Tag = info;
                 this.treeViewFolders.SelectedNode.Nodes.Add(node);
                 this.treeViewFolders.SelectedNode.Expand();
             }
         }
     }
 }
예제 #25
0
        private static void Export(Toon dataToon)
        {
            var msgResult = MessageBox.Show(@"Would you like to enter a description for people to see?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (msgResult == DialogResult.Yes)
            {
                InputBoxResult result = InputBox.Show("Enter a description for your build.", "Build Description", "Enter your description here", InputBox.InputBoxIcon.Info, inputBox_Validating);
                dataToon.Description = result.OK ? result.Text : "None";
                dataToon.SubmittedBy = MidsContext.GetCryptedValue("BotUser", "username");
                dataToon.SubmittedOn = DateTime.Now.ToShortDateString();
                MbLogin();
                BuildSubmit(dataToon);
            }
            else
            {
                dataToon.Description = "None";
                dataToon.SubmittedBy = MidsContext.GetCryptedValue("BotUser", "username");
                dataToon.SubmittedOn = $"{DateTime.Now.ToShortDateString()} {DateTime.Now.ToShortTimeString()}";
                MbLogin();
                BuildSubmit(dataToon);
            }
        }
예제 #26
0
        private void btnConsultarNFSe_Click(object sender, EventArgs e)
        {
            try
            {
                rbPrintNFSe.Checked = true;
                string _resposta;
                CheckConfig();
                InputBoxResult Destino = InputBox.Show("Digite o Número da NFSe:", "Consultar NFSe", "", null);
                string         _Extras = "";
                if ((Destino.OK) && (Destino.Text != "") && PedirParametrosExtras(ref _Extras))
                {
                    _resposta = ProxyNFSe.ConsultarNota(Destino.Text, _Extras);
                    MostrarXML(_resposta);
                    rbPrintNFSe.Checked = true;
                    rtbCSV.Text         = NFSeConverter.ConverterRetConsultarNFSe(_resposta, "");

                    GetRetornoConsNFse(_resposta);
                }
            }
            catch (Exception ex)
            {
                TratarExcecao(ex);
            }
        }
예제 #27
0
 private void Save_Click(object sender, EventArgs e)
 {
     inputResult = InputBoxResult.Save;
     Close();
 }
예제 #28
0
 private void No_Click(object sender, EventArgs e)
 {
     inputResult = InputBoxResult.No;
     Close();
 }
예제 #29
0
 private void Cancel_Click(object sender, EventArgs e)
 {
     inputResult = InputBoxResult.Cancel;
     Close();
 }
예제 #30
0
        // shows users input based on whats been dragged on to the area
        public void formInput(Point cursorPos, string labelText, bool readOnly, bool requireRange, bool option, string type)
        {
            if (requireRange == true)
            {
                //Start Number
                while (true)
                {
                    InputBoxResult result = InputBox.Show("Type a start number", "Start Number", "0", null);
                    if (result.OK)
                    {
                        try
                        {
                            startRange = new int[] { Convert.ToInt32(result.Text) };
                            i++;
                            break;
                        }
                        catch (Exception)
                        {
                            MessageBox.Show("Type a number", "Please Type a number");
                        }
                    }
                }
                //End Number
                while (true)
                {
                    InputBoxResult result2 = InputBox.Show("Type an end number", "End Number", "0", null);
                    if (result2.OK)
                    {
                        try
                        {
                            if (startRange[i] >= 0 && Convert.ToInt32(result2.Text) <= startRange[i])
                            {
                                MessageBox.Show("End Rnage cannot be smaller than start range", "Number is invalid");
                            }
                            else
                            {
                                endRange = new int[] { Convert.ToInt32(result2.Text) };
                                break;
                            }
                        }
                        catch (Exception)
                        {
                            MessageBox.Show("Type a number", "Please Type a number");
                        }
                    }
                }
            }

            if (option == true)
            {
                while (true)
                {
                    InputBoxResult result3 = InputBox.Show("Type the number of elements for the radio, select or checkbox ect.", "Type the Number", "0", null);
                    if (result3.OK && result3.Text != "0")
                    {
                        try
                        {
                            if (type == "Radio")
                            {
                                inpType[type + j] = Convert.ToInt32(result3.Text);
                                j++;
                            }
                            else if (type == "Select")
                            {
                                inpType[type + k] = Convert.ToInt32(result3.Text);
                                k++;
                            }
                            else if (type == "Check")
                            {
                                inpType[type + l] = Convert.ToInt32(result3.Text);
                                l++;
                            }
                            break;
                        }
                        catch (Exception)
                        {
                            MessageBox.Show("Type a number", "Please Type a number");
                        }
                    }
                    else
                    {
                        MessageBox.Show("Type a number greater than 0", "Please Type a number");
                    }
                }
            }

            Label info = new Label();

            info.Location = new Point(73, cursorPos.Y + yPos);
            info.Size     = new Size(120, 17);
            info.Text     = labelText;
            info.Name     = "info" + formNo;
            panel2.Controls.Add(info);

            TextBox txtBox = new TextBox();

            txtBox.Location = new Point(cursorPos.Y, cursorPos.Y + yPos + 30);
            txtBox.Size     = new Size(187, 22);
            txtBox.ReadOnly = readOnly;
            txtBox.Name     = "txtBoxN" + formNo;
            if (readOnly == false)
            {
                txtBox.Text = "This is for the Name of the form element";
            }
            else
            {
                txtBox.Text = "Nothing to type here";
            }
            panel2.Controls.Add(txtBox);

            TextBox txtBox1 = new TextBox();

            txtBox1.Location = new Point(cursorPos.Y, cursorPos.Y + yPos + 60);
            txtBox1.Size     = new Size(187, 22);
            txtBox1.ReadOnly = readOnly;
            txtBox1.Name     = "txtBoxP" + formNo;
            if (readOnly == false)
            {
                if (type == "Radio" || type == "Check" || type == "Select")
                {
                    txtBox1.Text     = "Nothing to type here";
                    txtBox1.ReadOnly = true;
                }
                else
                {
                    txtBox1.Text = "Type placeholder text in here";
                }
            }
            else
            {
                txtBox1.Text = "Nothing to type here";
            }
            panel2.Controls.Add(txtBox1);

            yPos = yPos + cursorPos.Y + 90;
            formNo++;
        }
예제 #31
0
파일: Msg.cs 프로젝트: supuy-ruby/Aoite
 /// <summary>
 /// 显示一个输入框。
 /// </summary>
 /// <param name="owner">控件拥有者。</param>
 /// <param name="parameters">输入框参数。</param>
 /// <returns>返回输入框的值。</returns>
 public static InputBoxResult InputBox(this Control owner, InputBoxParameters parameters)
 {
     if (owner != null && owner.InvokeRequired)
     {
         return (InputBoxResult)owner.Invoke(new Func<Control, InputBoxParameters, InputBoxResult>(InputBox), owner, parameters);
     }
     else
     {
         var form = new InputBoxForm(owner, parameters);
         if (owner == null)
         {
             return new InputBoxResult(parameters.Editors, form);
         }
         var ownerForm = owner.FindForm();
         ownerForm.Activate();
         var r = new InputBoxResult(parameters.Editors, form);
         ownerForm.Activate();
         return r;
     }
 }
예제 #32
0
        public List <FavoriteConfigurationElement> ImportFavorites(string Filename)
        {
            List <FavoriteConfigurationElement> fav = new List <FavoriteConfigurationElement>();
            InputBoxResult result = InputBox.Show("Password:"******"Enter vRD Password", '*');

            if (result.ReturnCode == System.Windows.Forms.DialogResult.OK)
            {
                byte[] file = File.ReadAllBytes(Filename);
                string xml  = a(file, result.Text).Replace(" encoding=\"utf-16\"", "");
                byte[] data = ASCIIEncoding.Default.GetBytes(xml);
                using (MemoryStream sw = new MemoryStream(data))
                {
                    if (sw.Position > 0 & sw.CanSeek)
                    {
                        sw.Seek(0, SeekOrigin.Begin);
                    }
                    XmlSerializer x       = new XmlSerializer(typeof(vRDConfigurationFile));
                    object        results = x.Deserialize(sw);

                    List <Connection> connections = new List <Connection>();
                    List <vRDConfigurationFileConnectionsFolder> folders = new List <vRDConfigurationFileConnectionsFolder>();
                    Dictionary <string, vRDConfigurationFileCredentialsFolderCredentials> credentials = new Dictionary <string, vRDConfigurationFileCredentialsFolderCredentials>();

                    if (results == null)
                    {
                        return(fav);
                    }
                    vRDConfigurationFile config = (results as vRDConfigurationFile);
                    if (config == null)
                    {
                        return(fav);
                    }
                    //scan in config item
                    foreach (object item in config.Items)
                    {
                        if (item == null)
                        {
                            continue;
                        }
                        if (item is vRDConfigurationFileCredentialsFolder)
                        {
                            //scan in all credentials into a dictionary
                            vRDConfigurationFileCredentialsFolder credentialFolder = (item as vRDConfigurationFileCredentialsFolder);
                            if (credentialFolder != null && credentialFolder.Credentials != null)
                            {
                                foreach (vRDConfigurationFileCredentialsFolderCredentials cred in credentialFolder.Credentials)
                                {
                                    credentials.Add(cred.Guid, cred);
                                }
                            }
                        }
                        else if (item is vRDConfigurationFileCredentialsFolderCredentials)
                        {
                            vRDConfigurationFileCredentialsFolderCredentials cred = (item as vRDConfigurationFileCredentialsFolderCredentials);
                            credentials.Add(cred.Guid, cred);
                        }
                        else if (item is Connection)
                        {
                            //scan in the connections
                            Connection connection = (item as Connection);
                            if (connection != null)
                            {
                                connections.Add(connection);
                            }
                        }
                        else
                        {
                            //scan in recurse folders
                            vRDConfigurationFileConnectionsFolder folder = item as vRDConfigurationFileConnectionsFolder;
                            if (folder != null)
                            {
                                folders.Add(folder);
                            }
                        }
                    }
                    //save credential item to local
                    SaveCredentials(credentials);
                    //save VRD connection to local
                    fav = ConvertVRDConnectionCollectionToLocal(connections.ToArray(), folders.ToArray(), null,
                                                                String.Empty, credentials);
                }
            }
            return(fav);
        }