コード例 #1
0
        public static bool CheckReferencedAssemblies()
        {
            Assembly lEntryAssembly = Assembly.GetEntryAssembly();

            foreach (AssemblyName iAsmName in lEntryAssembly.GetReferencedAssemblies())
            {
                if (iAsmName.Name.IndexOf("System") == 0)
                {
                    continue;
                }
                if (iAsmName.Name.ToUpper().IndexOf("MSCORLIB") == 0)
                {
                    continue;
                }
                if (GACUtil.GetAssembly(iAsmName.Name) == null)
                {
                    CRSMessageBox.ShowBox(
                        Locale.GetMessage("assemblyMissing") + '\n' + iAsmName.FullName,
                        Locale.GetMessageTitle("assemblyMissing"),
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Error
                        );


                    //return false;
                }
            }

            return(true);
        }
コード例 #2
0
        public static RsReportCollection LoadCollection(string aCollectionName)
        {
            if (!File.Exists(aCollectionName))
            {
                if (CRSMessageBox.ShowBox(
                        Locale.GetMessageTitle("collectionMissing"),
                        Locale.GetMessage("collectionMissing"),
                        MessageBoxButtons.YesNo,
                        MessageBoxIcon.Question
                        ) == DialogResult.No)
                {
                    return(null);
                }
            }

            return(CollectionManager.GetCollection(aCollectionName));

            //RsReportCollection lNewCollection = CollectionManager.GetCollection(aCollectionName);

#if DEMO
            try {
                long lVal    = ReportSmart.Authorization.AppAuth.chkshwauthfrw(ReportSmart.Authorization.AppAuth.crdtstamp(new DateTime(2010, 5, 23), _YM, _MM, _DM), _YM, _MM, _DM, _PERIOD);
                long lChkval = ReportSmart.Authorization.AppAuth.gnchkval(_YM, _MM, _DM, _PERIOD);
                Math.Sqrt(lVal - lChkval);
            } catch {
                KillApplication();
            }
#endif

            //lNewCollection.LoadFromXML(aCollectionName);
            //return lNewCollection;
        }
コード例 #3
0
        public static bool SaveCollection(RsReportCollection aCollection)
        {
            if (aCollection.FileName == "")
            {
                bool lNoSave = false;

                while (RsViewEngine._dlgSaveCollection.ShowDialog() != DialogResult.OK)
                {
                    if (CRSMessageBox.ShowBox(
                            RsViewEngine.Locale.GetMessage("collectionmustsave"),
                            RsViewEngine.Locale.GetMessageTitle("collectionmustsave"),
                            MessageBoxButtons.OKCancel,
                            MessageBoxIcon.Asterisk
                            ) == DialogResult.Cancel)
                    {
                        lNoSave = true;
                        break;
                    }
                }

                if (!lNoSave)
                {
                    aCollection.SaveToXML(RsViewEngine._dlgSaveCollection.FileName);
                }
                else
                {
                    RsViewEngine.CloseCollection(aCollection);
                    return(false);
                }
            }
            else
            {
                aCollection.QuickSave();
            }

            return(true);
        }
コード例 #4
0
        public static void TreatCriticalError(Exception aException)
        {
            bool   lSendBug    = false;
            string lBugMessage = "Technical details:\n";

            if (aException != null)
            {
                lBugMessage = lBugMessage + aException.Message + "\nIn object \"" + aException.Source + "\"\n";
            }
            else
            {
                lBugMessage = lBugMessage + "Unknown error.";
            }

            lBugMessage = Version.ToString() + "\n" + lBugMessage;

            if (Locale != null)
            {
                if (aException != null)
                {
                    if (aException is NotImplementedException)
                    {
                        CRSMessageBox.ShowBox(
                            Locale.GetMessage("debug_notimplemented"),
                            Locale.GetMessageTitle("debug_notimplemented"),
                            MessageBoxButtons.OK,
                            MessageBoxIcon.Error,
                            aException.StackTrace
                            );

                        return;
                    }
                    else
                    {
                        lSendBug = CRSMessageBox.ShowBox(
                            Locale.GetTagText("appCrashed") + "\n" + aException.Message + "\n" + aException.Source,
                            Locale.GetTagText("appCritical"),
                            MessageBoxButtons.YesNo,
                            MessageBoxIcon.Error,
                            aException.StackTrace
                            ) == DialogResult.Yes;
                    }
                }
                else
                {
                    lSendBug = CRSMessageBox.ShowBox(
                        Locale.GetTagText("appCrashed"),
                        Locale.GetTagText("appCritical"),
                        MessageBoxButtons.YesNo,
                        MessageBoxIcon.Error,
                        aException.StackTrace
                        ) == DialogResult.Yes;
                }
            }
            else
            {
                lSendBug = MessageBox.Show(
                    "An unexpected error caused ReportSmart crash before or during load of localization.\n" +
                    "\"" + aException.Message + "\"\n" + aException.Source + "\n\nDo you want to send an error report to the vendor?\n" +
                    "\nStack trace: " + aException.StackTrace,
                    "ReportSmart",
                    MessageBoxButtons.YesNo, MessageBoxIcon.Error
                    ) == DialogResult.Yes;
            }
            if (_IsInitialized)
            {
                lBugMessage = "Problem after initalization has been finished.\n" + lBugMessage;
            }
            else
            {
                lBugMessage = "Problem before initalization has benn finished.\n" + lBugMessage;
            }

            if (_IsEmbedded)
            {
                lBugMessage = "Embedded instance caused error.\n" + lBugMessage;
            }
            else
            {
                lBugMessage = "Framework caused error.\n" + lBugMessage;
            }

            lBugMessage += "\nStack trace:\n" + aException.StackTrace;

            if (lSendBug)
            {
                IRSStatusBox lStatus;

                if (Locale != null)
                {
                    lStatus = CRSMessageBox.ShowStatusBox(RsViewEngine.Locale.GetMessage("bugreport"));
                }
                else
                {
                    lStatus = CRSMessageBox.ShowStatusBox("Sending bugreport...");
                }

                lStatus.SetStatus(20);
                System.Windows.Forms.Application.DoEvents();

                CEmailing.BugReport(
                    lBugMessage
                    );

                lStatus.HideBox();
            }

            if (_IsEmbedded)
            {
                Messaging.SendMessage(_EmbApp.Handle, Messaging.WM_SUICIDED, 0, 0);
            }

#if (!DEBUG)
            System.Environment.Exit(0);
#else
            if (_IsEmbedded)
            {
                System.Environment.Exit(0);
            }
            else
            {
                System.Windows.Forms.Application.Exit();
            }
#endif
        }