Exemple #1
0
 public static void OpenDocument(IWin32Window owner, string docName)
 {
     string docPath = Application.StartupPath + Path.DirectorySeparatorChar + docName;
     using (WaitingCursor waitingCursor = new WaitingCursor())
     {
         ProcessStartInfo startInfo = new ProcessStartInfo(docPath);
         try
         {
             Process.Start(startInfo);
         }
         catch (Exception ex)
         {
             waitingCursor.StopWaiting();
             MessageBox.Show(owner,
                 string.Format("Feil ved åpning av dokument:\r\n\r\n{0}\r\n\r\n{1}", docPath, ex.Message),
                 Global.FullTitle, MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }
Exemple #2
0
 private void ConnectToSelected()
 {
     Connection = list.SelectedObject as IDatabaseConnection;
     if (null == Connection) return;
     using (WaitingCursor waitingCursor = new WaitingCursor(this))
     {
         try
         {
             Connection.UnderlyingConnection.Open();
             Connection.UnderlyingConnection.Close();
             SqlCommon.History.MoveToTop(Connection);
             DialogResult = DialogResult.OK;
         }
         catch (Exception ex)
         {
             Cursor = Cursors.Default;
             MessageBox.Show(this, "Klarer ikke å koble til databasen:\r\n" + ex.Message, Global.FullTitle,
                 MessageBoxButtons.OK, MessageBoxIcon.Error);
             waitingCursor.StopWaiting();
         }
     }
 }