Пример #1
0
        //
        //When this method is used, it will show the MainUI
        public void ShowForm(UIApplication uiApp)
        {
            //Create a new RequestHandler object
            RequestHandler handler = new RequestHandler(_cachedUiCtrApp);
            //Create a new ExternalEvent object
            ExternalEvent exEvent = ExternalEvent.Create(handler);

            //Set newMainUI to a new instance of MainUI, passing the UIApplication, ExternalEvent, and RequestHandler it will need to use
            newMainUi = new MainUI(uiApp, exEvent, handler);
            //Set the newSPUi to a new instance of SharedParameterUI, which only needs UIApplication. Do not show until needed
            newSPUi = new SharedParametersUI(uiApp);

            CadDriveIsAccessible = GeneralOperations.IsCadDriveAccessible();
            if (CadDriveIsAccessible == false)
            {
                MessageBox.Show("Cannot access the K Drive. Some tools will not be functional.");
            }

            //Generate a new DataTable for collecting data
            appUseDataTable = new DataTable();
            //Prep the appUseDataTable by adding the appropriate columns using the following method
            DatabaseOperations.MakeAppUseDataTable(appUseDataTable);

            //Show the MainUI
            newMainUi.Show();
        }
Пример #2
0
        public static void CleanRfaBackups(string file)
        {
            if (file != "")
            {
                bool           isDirectory    = false;
                FileAttributes fileAttributes = File.GetAttributes(file);
                if ((fileAttributes & FileAttributes.Directory) == FileAttributes.Directory)
                {
                    isDirectory = true;
                }

                if (isDirectory)
                {
                    foreach (string filePath in GeneralOperations.GetAllRvtFamilies(file, true))
                    {
                        Match match1 = Regex.Match(filePath, @".00\d\d.rfa", RegexOptions.IgnoreCase);
                        if (match1.Success)
                        {
                            try
                            {
                                File.Delete(filePath);
                            }
                            catch { MessageBox.Show(String.Format("Could not delete {0}", filePath)); }
                        }
                    }
                }
                else
                {
                    Match match1 = Regex.Match(file, @".00\d\d.rfa", RegexOptions.IgnoreCase);
                    if (match1.Success)
                    {
                        try
                        {
                            File.Delete(file);
                        }
                        catch { MessageBox.Show(String.Format("Could not delete {0}", file)); }
                    }
                }
            }
        }