示例#1
0
        private void btnIONAPI_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                OpenFileDialog ofdDialog = new OpenFileDialog();
                ofdDialog.Filter          = "ION API Files (*.ionapi)|*.ionapi";
                ofdDialog.CheckFileExists = true;

                if (true == ofdDialog.ShowDialog())
                {
                    string fileName = ofdDialog.FileName;

                    tbIONAPIPath.Text = fileName;

                    IONAPIFile ionAPI = IONAPIFile.LoadIONAPI(fileName);

                    if (null != ionAPI && true == string.IsNullOrEmpty(ionAPI.Error))
                    {
                        ionAPI.mainWindow = this;
                        tbTenant.Text     = ionAPI.getTenant();
                        tbCI.Text         = ionAPI.getClientId();
                        credentials       = ionAPI;
                    }
                    else
                    {
                        if (null == ionAPI)
                        {
                            MessageBox.Show("Error failed to read file");
                        }
                        else
                        {
                            MessageBox.Show("Error: " + ionAPI.Error);
                        }
                    }
                }
                ofdDialog = null;
            }
            catch (Exception ex)
            {
            }
        }