/// <summary>
        /// Cancel button closes this dialog
        /// </summary>
        /// <param name="sender">Object that fired the event</param>
        /// <param name="e">.NET supplied event parameters</param>
        private void btnCancel_Click(object sender, System.EventArgs e)
        {
            this.project          = null;
            this.MetaDataProvider = null;
            this.SelectedTable    = null;

            this.Close();
        }
        /// <summary>
        /// Dialog to select a tble 
        /// </summary>       
        /// <param name="frm">The main form</param>
        public TableSelectionDialog(Epi.Windows.MakeView.Forms.MakeViewMainForm frm)
            : base(frm)
        {
            // This call is required by the Windows Form Designer.
            InitializeComponent();

            if (frm.projectExplorer != null)
            {
                if (frm.projectExplorer.currentPage != null)
                {
                    this.project = frm.projectExplorer.currentPage.view.Project;
                    this.MetaDataProvider = this.project.Metadata;
                }
            }
        }
        /// <summary>
        /// Dialog to select a tble
        /// </summary>
        /// <param name="frm">The main form</param>
        public TableSelectionDialog(Epi.Windows.MakeView.Forms.MakeViewMainForm frm)
            : base(frm)
        {
            // This call is required by the Windows Form Designer.
            InitializeComponent();


            if (frm.projectExplorer != null)
            {
                if (frm.projectExplorer.currentPage != null)
                {
                    this.project          = frm.projectExplorer.currentPage.view.Project;
                    this.MetaDataProvider = this.project.Metadata;
                }
            }
        }
        private void Button3_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            // openFileDialog.Filter = "Epi2000 and Epi7 Project Files (*.mdb;*.prj)|*.mdb;*.prj|Epi2000 Project files (*.mdb)|*.mdb |Epi7 Project Files (*.prj)|*.prj";
#if LINUX_BUILD
            openFileDialog.Filter = "*.prj";
#else
            openFileDialog.Filter = "Epi2000 and Epi7 Project Files (*.mdb;*.prj)|*.mdb;*.prj|Epi2000 Project files (*.mdb)|*.mdb|Epi7 Project Files (*.prj)|*.prj";
#endif

            openFileDialog.FilterIndex = 1;
            openFileDialog.Multiselect = false;
            DialogResult res = openFileDialog.ShowDialog();
            if (res == DialogResult.OK)
            {
                string filePath = openFileDialog.FileName.Trim();
                System.Collections.Generic.List <string> TableList;

                if (filePath.EndsWith(".prj"))
                {
                    this.project          = new Project(filePath);
                    this.MetaDataProvider = this.project.Metadata;
                    TableList             = this.project.Metadata.GetDataTableList();
                }
                else
                {
                    // to do
                    TableList = new System.Collections.Generic.List <string>();
                    TableList.Add("to do add datatables for non epi7 projects");
                }
                ListBox1.Items.Clear();
                this.Text = "Selected Project: " + this.project.Name;
                foreach (string t in TableList)
                {
                    if (!string.IsNullOrEmpty(t))
                    {
                        ListBox1.Items.Add(t);
                    }
                }
            }
        }
 public void Reset()
 {
     this.mCurrentView = new Stack<RunTimeView>();
     this.mCurrentProject = null;
 }
        /// <summary>
        /// Cancel button closes this dialog 
        /// </summary>
        /// <param name="sender">Object that fired the event</param>
        /// <param name="e">.NET supplied event parameters</param>
        private void btnCancel_Click(object sender, System.EventArgs e)
        {
            this.project = null;
            this.MetaDataProvider = null;
            this.SelectedTable = null;

            this.Close();
        }
        private void Button3_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();
            // openFileDialog.Filter = "Epi2000 and Epi7 Project Files (*.mdb;*.prj)|*.mdb;*.prj|Epi2000 Project files (*.mdb)|*.mdb |Epi7 Project Files (*.prj)|*.prj";
            #if LINUX_BUILD
            openFileDialog.Filter = "*.prj";
            #else
            openFileDialog.Filter = "Epi2000 and Epi7 Project Files (*.mdb;*.prj)|*.mdb;*.prj|Epi2000 Project files (*.mdb)|*.mdb|Epi7 Project Files (*.prj)|*.prj";
            #endif

            openFileDialog.FilterIndex = 1;
            openFileDialog.Multiselect = false;
            DialogResult res = openFileDialog.ShowDialog();
            if (res == DialogResult.OK)
            {

                string filePath = openFileDialog.FileName.Trim();
                System.Collections.Generic.List<string> TableList;

                if (filePath.EndsWith(".prj"))
                {
                    this.project = new Project(filePath);
                    this.MetaDataProvider = this.project.Metadata;
                    TableList = this.project.Metadata.GetDataTableList();
                }
                else
                {
                    // to do
                    TableList = new System.Collections.Generic.List<string>();
                    TableList.Add("to do add datatables for non epi7 projects");
                }
                ListBox1.Items.Clear();
                this.Text = "Selected Project: " + this.project.Name;
                foreach (string t in TableList)
                {
                    if (!string.IsNullOrEmpty(t))
                    {
                        ListBox1.Items.Add(t);
                    }
                }

            }
        }
Beispiel #8
0
 public void Reset()
 {
     this.mCurrentView    = new Stack <RunTimeView>();
     this.mCurrentProject = null;
 }
Beispiel #9
0
        private async void CheckForDbConnectivityAsync()
        {
            if (IsShowingConnectionEditor == true || IsCheckingConnection == true) // don't check for connectivity while the editor is open or if we're already checking
            {
                return;
            }

            IsCheckingConnection = true;

            await Task.Factory.StartNew(delegate
            {
                Epi.Project project = null;

                try
                {
                    if (!System.IO.File.Exists(this.FileInfo.FullName))
                    {
                        IsConnected          = false;
                        IsCheckingConnection = false;
                        return;
                    }

                    project = new Epi.Project(this.FileInfo.FullName);
                    Epi.Data.IDbDriver db = project.CollectedData.GetDatabase();
                    if (db != null)
                    {
                        ConnectionString      = db.ConnectionString;
                        InputConnectionString = db.ConnectionString;

                        if (db is Epi.Data.Office.OleDbDatabase)
                        {
                            IsLocalStorage       = true;
                            IsServerBasedStorage = false;
                        }
                        else
                        {
                            IsLocalStorage       = false;
                            IsServerBasedStorage = true;
                        }
                    }
                    //if (project.CollectedData.GetDatabase() is Epi.Data.Office.OleDbDatabase)
                    //{
                    //    string dataSource = project.CollectedData.DataSource;
                    //    dataSource = dataSource.Replace("data source=", String.Empty);
                    //    bool fileExists = System.IO.File.Exists(dataSource);
                    //    if (!fileExists)
                    //    {
                    //        IsConnected = false;
                    //        return;
                    //    }
                    //}

                    Epi.View view = project.Views["CaseInformationForm"];
                    IsConnected   = true;
                }
                catch (Epi.GeneralException)
                {
                    IsConnected = false;
                }
                catch (System.Security.Cryptography.CryptographicException)
                {
                    // keys don't match
                    IsConnected = false;
                }
                catch (Exception)
                {
                    IsConnected = false;
                }
                finally
                {
                    if (project != null)
                    {
                        project.Dispose();
                    }

                    IsCheckingConnection = false;
                }
            });
        }