Exemple #1
0
        //Print Excel File Name
        public void PrintFileName(string FileFullPath)
        {
            //Get the File Name
            string FileName = Path.GetFileNameWithoutExtension(FileFullPath);

            //Get the File Path
            string FilePath = DesignUtils.TrimFilePath(FileFullPath, Directory.GetCurrentDirectory());

            //Fill File Path to the Form
            ModelProperty property = this.ModelItem.Properties["FilePathPreview"];

            property.SetValue(new InArgument <string>(FilePath));

            //Check if Storage Files exists
            bool bExists = File.Exists(Directory.GetCurrentDirectory() + "/" + "StorageTextToolbox/FileNames/" + FileName + ".txt");

            //If false create directory files
            if (bExists == false)
            {
                //Write Excel File Sheets to Text File in Storage
                DesignUtils.WriteTextFileSingleFile(FileFullPath, MyIDText);
            }

            //Button Refresh Current File
            Button_RefreshCurrentFile();
        }
Exemple #2
0
        //Update IDText
        private void UpdateIDText()
        {
            //Get IDText, if there is
            MyIDText = ReturnIDText();

            if (MyIDText != null)
            {
                string FilePath = Directory.GetCurrentDirectory() + "/StorageTextToolbox/Infos/" + MyIDText + ".txt";

                //Case there is no file, create it!
                if (File.Exists(FilePath) == false)
                {
                    //Create Blank Text File
                    System.IO.File.WriteAllText(Directory.GetCurrentDirectory() + "/StorageTextToolbox/Infos/" + MyIDText + ".txt", "");
                }
            }


            if (MyIDText == null)
            {
                //Generate IDText
                MyIDText = DesignUtils.GenerateIDText();

                //Create Blank Text File
                System.IO.File.WriteAllText(Directory.GetCurrentDirectory() + "/StorageTextToolbox/Infos/" + MyIDText + ".txt", "");

                //Write data to the Form
                ModelProperty property = this.ModelItem.Properties["IDText"];
                property.SetValue(new InArgument <string>(MyIDText));
            }
        }
        private bool EditSharePointCredentialConnection(IWin32Window parentWindow, Connections connections)
        {
            using (CredentialConnectionManagerForm form = new CredentialConnectionManagerForm())
            {
                form.Initialize(this._serviceProvider, this.ConnectionManager, this.ErrorCollectionService);

                if (DesignUtils.ShowDialog(form, parentWindow, this._serviceProvider) == DialogResult.OK)
                {
                    if (!this.ConnectionManager.Name.Equals(form.ConnectionName, StringComparison.OrdinalIgnoreCase))
                    {
                        this.ConnectionManager.Name =
                            ConnectionManagerUtils.GetConnectionName(connections, form.ConnectionName);
                    }

                    ConnectionManager.Description = form.ConnectionDescription;

                    CredentialConnectionManager innerManager = (CredentialConnectionManager)ConnectionManager.InnerObject;

                    if (form.CanUseDefaultCredentials)
                    {
                        innerManager.UserName = string.Empty;
                        innerManager.Password = string.Empty;
                    }
                    else
                    {
                        innerManager.UserName = form.UserName;
                        innerManager.Password = form.Password;
                    }

                    return(true);
                }
            }

            return(false);
        }
        public FindArrayItemsDesigner()
        {
            InitializeComponent();

            //Create Default Storage Folders (if needed)
            DesignUtils.CreateStorageTextToolboxFolders();
        }
Exemple #5
0
        public RemoveEmptyRowsDesigner()
        {
            InitializeComponent();

            //Create Default Storage Folders (if needed)
            DesignUtils.CreateStorageTextToolboxFolders();
        }
        //Regex Parameter Update Event
        private void MyRegexParameterComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            //Update IDText
            UpdateIDText();

            Encoding encoding = Encoding.Default;

            //Return IDText Parent
            string MyIDTextParent = DesignUtils.ReturnCurrentFileIDText();

            if (MyIDTextParent != null)
            {
                //Get Encoding
                encoding = DesignUtils.GetEncodingIDText(MyIDTextParent);

                //Fill in Global Variable
                MyArgument = "Regex Parameter";

                //Get ITem from the ComboBox
                string MyRegexParameterComboBox = this.RegexParameterComboBox.SelectedItem.ToString();

                //Log ComboBox
                DesignUtils.CallLogComboBox(MyIDText, MyArgument, MyRegexParameterComboBox, encoding);
            }
        }
Exemple #7
0
        public ReadTextFileEncondigDesigner()
        {
            InitializeComponent();

            //Create Default Storage Folders (if needed)
            DesignUtils.CreateStorageTextToolboxFolders();
        }
        //Paste to from the Clipboard
        private void Button_PasteFromClipboard(object sender, RoutedEventArgs e)
        {
            //Get the File Path
            string FilePath = Directory.GetCurrentDirectory() + "/StorageTextToolbox/Infos/" + MyIDText + ".txt";

            //Get Item from the ComboBox
            string MyEncoding = ReturnEncoding();

            if (MyEncoding != null)
            {
                Encoding encoding = Encoding.Default;

                //Get Encoding
                encoding = DesignUtils.GetEncodingIDText(MyIDText);

                //Paste Argument from the Clipboard
                string OutputText = DesignUtils.PasteArgumentFromClipboard();

                //Update Control
                UpdateControl(MyArgument.Replace(" ", ""), OutputText);

                //Update Text File Row Argument
                DesignUtils.CallUpdateTextFileRowArgument(FilePath, MyArgument, OutputText, encoding);
            }
        }
        private bool EditCloudDBConnection(IWin32Window parentWindow, Connections connections)
        {
            SsdsConnectionManagerForm form = new SsdsConnectionManagerForm();

            form.Initialize(this._serviceProvider, this.ConnectionManager, this.ErrorCollectionService);

            if (DesignUtils.ShowDialog(form, parentWindow, this._serviceProvider) == DialogResult.OK)
            {
                string cs = form.GetConnectionString(ConnectionStringDisplayOption.IncludePassword);
                ConnectionManager.ConnectionString = cs;

                if (!this.ConnectionManager.Name.Equals(form.ConnectionName, StringComparison.OrdinalIgnoreCase))
                {
                    this.ConnectionManager.Name =
                        ConnectionManagerUtils.GetConnectionName(connections, form.ConnectionName);
                }

                ConnectionManager.Description = form.ConnectionDescription;

                SsdsConnectionManager innerManager = (SsdsConnectionManager)ConnectionManager.InnerObject;

                innerManager.Authority = form.Authority;
                innerManager.UserName  = form.UserName;
                innerManager.Password  = form.Password;

                return(true);
            }

            return(false);
        }
Exemple #10
0
        //Select File Name
        private void Button_MenuItem_fileName_Click(object sender, RoutedEventArgs e)
        {
            //Get the Click Item
            var item = e.OriginalSource as System.Windows.Controls.MenuItem;

            //Get Storage File
            string StorageFile = item.Tag.ToString();

            //Read Sheets Names from the File
            string FilePath = System.IO.File.ReadAllText(StorageFile);

            //Check if file exists
            bool bExists = File.Exists(FilePath);

            //Print file in case it is found
            if (bExists == true)
            {
                ////Print Excel File Name
                PrintFileName(FilePath);
            }
            else
            {
                //Get the File Name
                string FileName = Path.GetFileNameWithoutExtension(FilePath);

                //Delete in case it is not found
                DesignUtils.DeleteStorageTextFileRun(FileName);

                //Error Message
                MessageBox.Show($"File '{FileName}' was not found and deleted from the list", "Select File", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Exemple #11
0
        //Button Open Preview
        private void Button_OpenPreview(object sender, RoutedEventArgs e)
        {
            string   FilePath    = null;
            string   Source      = null;
            double   PercResults = 0;
            Encoding encoding    = Encoding.Default;

            //Return IDText Parent
            string MyIDTextParent = DesignUtils.ReturnCurrentFileIDText();

            //Get Encoding
            encoding = DesignUtils.GetEncodingIDText(MyIDTextParent);

            //Get the Current File
            FilePath = Directory.GetCurrentDirectory() + "/StorageTextToolbox/CurrentFile.txt";
            Source   = System.IO.File.ReadAllText(FilePath);
            string inputText = System.IO.File.ReadAllText(Source, encoding);

            //Get File Path
            FilePath = Directory.GetCurrentDirectory() + "/StorageTextToolbox/Infos/" + MyIDText + ".txt";
            Source   = System.IO.File.ReadAllText(FilePath, encoding);

            //Check if all Parameters are in the File
            string[] searchWords = { "Search Words" + Utils.DefaultSeparator() };
            PercResults = Utils.FindWordsInString(Source, searchWords, false);

            //Case it is found
            if (PercResults == 1)
            {
                //Split the Line
                string[] MyArray = Strings.Split(Source, Utils.DefaultSeparator());

                //Fill in the Variables
                string MyArgument = MyArray[0];
                string MyValue    = MyArray[1];

                //'Convert' Array to String
                string[] SearchWords = DesignUtils.ConvertStringToArray(MyValue, false);

                //Find Words in String
                PercResults = Utils.FindWordsInString(inputText, SearchWords, false);

                //Display Result
                MessageBox.Show($"Percentage: {PercResults.ToString("P", CultureInfo.InvariantCulture)}", "Count Words in String");
            }
            else
            {
                //Delete Argument in case it is null
                MyArgument = "Search Words";
                DesignUtils.DeleteTextFileRowArgument(FilePath, MyArgument, encoding);

                //Error Message
                MessageBox.Show("Please fill in all arguments", "Validation Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
        //Button Open Preview
        private void Button_OpenPreview(object sender, RoutedEventArgs e)
        {
            //Return IDText Parent
            string MyIDTextParent = DesignUtils.ReturnCurrentFileIDText();

            //Get Encoding
            Encoding encoding = DesignUtils.GetEncodingIDText(MyIDTextParent);

            //Open Form Preview Extraction
            DesignUtils.CallformPreviewExtraction(null, "Split Text By Blank Lines", MyIDTextParent, encoding);
        }
        //Button Open Preview
        private void Button_OpenPreview(object sender, RoutedEventArgs e)
        {
            //Get the File Path
            string FilePath = Directory.GetCurrentDirectory() + "/StorageTextToolbox/Infos/" + MyIDText + ".txt";

            //Check if file exists
            bool bExists = File.Exists(FilePath);

            if (bExists == true)
            {
                #region Open Preview Extraction

                //Auto Fill Controls
                AutoFillControls();

                //Get Item from the ComboBox
                string MyEncoding = ReturnEncoding();

                if (MyEncoding != null)
                {
                    Encoding encoding = Utils.ConvertStringToEncoding(MyEncoding);

                    //Read Text File
                    string Source = System.IO.File.ReadAllText(FilePath, encoding);

                    //Check if all Parameters are in the File
                    string[] searchWords = { "FileName" + Utils.DefaultSeparator(), "Encoding" + Utils.DefaultSeparator() };
                    double   PercResults = Utils.FindWordsInString(Source, searchWords, false);

                    //Case all Parameters are found
                    if (PercResults == 1)
                    {
                        //Button Refresh Current File
                        Button_RefreshCurrentFile();

                        //Open Form Preview Extraction
                        DesignUtils.CallformPreviewExtraction(MyIDText, "Text Application Scope", MyIDText, encoding);
                    }
                    else
                    {
                        //Error Message
                        MessageBox.Show("Please fill in all arguments", "Validation Error", MessageBoxButton.OK, MessageBoxImage.Error);
                    }
                }
                else
                {
                    //Error Message
                    MessageBox.Show("Please fill in all arguments", "Validation Error", MessageBoxButton.OK, MessageBoxImage.Error);
                }

                #endregion
            }
        }
        //Button Open Preview
        private void Button_OpenPreview(object sender, RoutedEventArgs e)
        {
            Encoding encoding = Encoding.Default;

            //Return IDText Parent
            string MyIDTextParent = DesignUtils.ReturnCurrentFileIDText();

            //Get Encoding
            encoding = DesignUtils.GetEncodingIDText(MyIDTextParent);

            //Get the File Path
            string FilePath = Directory.GetCurrentDirectory() + "/StorageTextToolbox/Infos/" + MyIDText + ".txt";

            //Occurence Position
            MyArgument = "Occurence Position";
            string OccurencePosition = ReturnOccurrenceNumber();

            if (OccurencePosition != null)
            {
                //Update Text File Row Argument
                DesignUtils.CallUpdateTextFileRowArgument(FilePath, MyArgument, OccurencePosition, encoding);
            }
            else
            {
                //Delete Argument in case it is null
                DesignUtils.DeleteTextFileRowArgument(FilePath, MyArgument, encoding);
            }

            #region Open Preview Extraction

            //Read Text File
            string Source = System.IO.File.ReadAllText(FilePath, encoding);

            //Check if all Parameters are in the File
            string[] searchWords = { "Words" + Utils.DefaultSeparator(), "Occurence Parameter" + Utils.DefaultSeparator() };
            double   PercResults = Utils.FindWordsInString(Source, searchWords, false);

            //Case all Parameters are found
            if (PercResults == 1)
            {
                //Open Form Preview Extraction
                DesignUtils.CallformPreviewExtraction(MyIDText, "Remove Words", MyIDTextParent, encoding);
            }
            else
            {
                //Error Message
                MessageBox.Show("Please fill in all arguments", "Validation Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }

            #endregion
        }
        //Anchor Words Parameter Update Event
        private void AnchorWordsParamComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            //Update IDText
            UpdateIDText();

            //Get Encoding
            Encoding encoding = DesignUtils.GetEncodingIDText(MyIDText);

            //Fill in Global Variable
            MyArgument = "Anchor Words Parameter";

            //Get ITem from the ComboBox
            string MyAnchorTextParamComboBox = this.AnchorWordsParamComboBox.SelectedItem.ToString();

            //Log ComboBox
            DesignUtils.CallLogComboBox(MyIDText, MyArgument, MyAnchorTextParamComboBox, encoding);
        }
        //Auto Fill Controls
        public void AutoFillControls()
        {
            //Check if File Exists, if not create it

            //Get the File Path
            string FilePath = Directory.GetCurrentDirectory() + "/StorageTextToolbox/Infos/" + MyIDText + ".txt";

            //If false create it
            if (File.Exists(FilePath) == false)
            {
                //Create File
                System.IO.File.WriteAllText(FilePath, "");
            }

            #region Encoding

            string MyArgument = "Encoding";

            //Get Item from the ComboBox
            string MyEncoding = ReturnEncoding();

            if (MyEncoding != null)
            {
                Encoding encoding = Utils.ConvertStringToEncoding(MyEncoding);

                //Log ComboBox
                DesignUtils.CallLogComboBox(MyIDText, MyArgument, MyEncoding, encoding);

                #region File Name

                //Copy the Arguments, in case there is
                string FilePathPreview = ReturnCurrentFile();

                if (FilePathPreview != null)
                {
                    //Update Text File Row Argument
                    DesignUtils.CallUpdateTextFileRowArgument(FilePath, "FileName", FilePathPreview, encoding);
                }

                #endregion
            }


            #endregion
        }
        //Button Open Wizard
        private void Button_OpenFormSelectData(object sender, RoutedEventArgs e)
        {
            //Show Update Call Control
            this.FilterWords.Visibility = Visibility.Hidden;
            this.UpdateCall.Visibility  = Visibility.Visible;
            this.UpdateCall.Content     = Utils.DefaultUpdateControl();

            //Get the File Path
            string FilePath = Directory.GetCurrentDirectory() + "/StorageTextToolbox/Infos/" + MyIDText + ".txt";

            //Get Item from the ComboBox
            string MyEncoding = ReturnEncoding();

            if (MyEncoding != null)
            {
                Encoding encoding = Utils.ConvertStringToEncoding(MyEncoding);

                string Source = System.IO.File.ReadAllText(FilePath, encoding);

                //Check if all Parameters are in the File
                string[] searchWords = { "FileName" + Utils.DefaultSeparator(), "Anchor Words Parameter" + Utils.DefaultSeparator() };
                double   PercResults = Utils.FindWordsInString(Source, searchWords, false);

                //Case it is found
                if (PercResults == 1)
                {
                    //Get Current File
                    FilePath = ReturnCurrentFile();

                    //Open Form Select Data
                    DesignUtils.CallformSelectDataOpen(MyArgument, MyIDText, FilePath, MyIDText, encoding);
                }
                else
                {
                    //Error Message
                    MessageBox.Show("Please fill in all arguments", "Validation Error", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
            else
            {
                //Error Message
                MessageBox.Show("Please fill in all arguments", "Validation Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
        //Button Open Wizard
        private void Button_OpenFormSelectData(object sender, RoutedEventArgs e)
        {
            //Show Update Call Control
            this.Words.Visibility      = Visibility.Hidden;
            this.UpdateCall.Visibility = Visibility.Visible;
            this.UpdateCall.Content    = Utils.DefaultUpdateControl();

            //Get File Path
            string FilePath = System.IO.File.ReadAllText(Directory.GetCurrentDirectory() + "/StorageTextToolbox/CurrentFile.txt");

            //Return IDText Parent
            string MyIDTextParent = DesignUtils.ReturnCurrentFileIDText();

            //Get Encoding
            Encoding encoding = DesignUtils.GetEncodingIDText(MyIDTextParent);

            //Open Form Select Data
            DesignUtils.CallformSelectDataOpen(MyArgument, MyIDText, FilePath, MyIDTextParent, encoding);
        }
        //Occurences Update Event
        private void OccurrencesComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            Encoding encoding = Encoding.Default;

            //Return IDText Parent
            string MyIDTextParent = DesignUtils.ReturnCurrentFileIDText();

            //Get Encoding
            encoding = DesignUtils.GetEncodingIDText(MyIDTextParent);

            //Update IDText
            UpdateIDText();

            string MyOccurenceParameter = null;

            //Fill in Global Variable
            MyArgument = "Occurence Parameter";

            //Get IDText, if there is
            MyIDText = ReturnIDText();

            //Get item from the ComboBox
            MyOccurenceParameter = (string)OccurrencesComboBox.SelectedValue;

            //Log ComboBox
            DesignUtils.CallLogComboBox(MyIDText, MyArgument, MyOccurenceParameter, encoding);

            //Hide / Display Occurence Number Control
            if (MyOccurenceParameter == "Custom")
            {
                //Visible
                this.OccurrenceNumber.Visibility = Visibility.Visible;
            }
            else
            {
                //Hidden
                this.OccurrenceNumber.Visibility = Visibility.Collapsed;

                //Clear Field Value
                ModelProperty property = this.ModelItem.Properties["OccurrenceNumber"];
                property.SetValue(null);
            }
        }
        //Create New TextID
        private void CreateNewIDText(object sender, RoutedEventArgs e)
        {
            string FilePath = null;

            //Get Encoding Parent

            //Return IDText Parent
            string MyIDTextParent = DesignUtils.ReturnCurrentFileIDText();

            //Get Encoding
            Encoding encoding = DesignUtils.GetEncodingIDText(MyIDTextParent);

            //Get Data from Current Text File

            MyIDText = ReturnIDText();

            //Get the File Path
            FilePath = Directory.GetCurrentDirectory() + "/StorageTextToolbox/Infos/" + MyIDText + ".txt";

            //Check if file exists
            if (File.Exists(FilePath) == true)
            {
                //Get Data from Text File
                string Source = System.IO.File.ReadAllText(FilePath, encoding);

                //New IDText

                //Clear the Current IDText
                ModelProperty property = this.ModelItem.Properties["IDText"];
                property.SetValue(null);

                //Update IDText
                UpdateIDText();

                //Set the New File Path
                FilePath = Directory.GetCurrentDirectory() + "/StorageTextToolbox/Infos/" + MyIDText + ".txt";

                //Write New Text File
                System.IO.File.WriteAllText(FilePath, Source);
            }
        }
        //Remove End Words Argument
        private void Button_RemoveEndWordsArgument(object sender, RoutedEventArgs e)
        {
            Encoding encoding = Encoding.Default;

            //Return IDText Parent
            string MyIDTextParent = DesignUtils.ReturnCurrentFileIDText();

            //Get Encoding
            encoding = DesignUtils.GetEncodingIDText(MyIDTextParent);

            //Clear the Control
            ModelProperty p2 = this.ModelItem.Properties["EndWords"];

            p2.SetValue(null);

            //Get the File Path
            string FilePath = Directory.GetCurrentDirectory() + "/StorageTextToolbox/Infos/" + MyIDText + ".txt";

            //Delete Argument in case it is null
            DesignUtils.DeleteTextFileRowArgument(FilePath, MyArgument, encoding);
        }
        //Setup Wizard Button
        private void CallButton_SetupWizard()
        {
            //Check if Current File is Updated
            string bUpdated = System.IO.File.ReadAllText(Directory.GetCurrentDirectory() + "/StorageTextToolbox/CurrentFileUpdated.txt");

            if (bUpdated == "-1")
            {
                #region Build Context Menu
                //Start Context Menu
                ContextMenu cm = new ContextMenu();

                #region Preview
                //Preview
                System.Windows.Controls.MenuItem menuPreview = new System.Windows.Controls.MenuItem();

                menuPreview.Header  = "Preview";
                menuPreview.Click  += Button_OpenPreview;
                menuPreview.ToolTip = "Preview Data Extraction With Current Activity Arguments";
                //Add Icon to the uri_menuItem
                var uri_menuPreview    = new System.Uri("https://img.icons8.com/officexs/20/000000/new-file.png");
                var bitmap_menuPreview = new BitmapImage(uri_menuPreview);
                var image_menuPreview  = new Image();
                image_menuPreview.Source = bitmap_menuPreview;
                menuPreview.Icon         = image_menuPreview;

                cm.Items.Add(menuPreview);
                #endregion

                //Open the Menu
                cm.IsOpen = true;


                #endregion
            }
            else
            {
                //Wizard Button: Warning Message: Preview
                DesignUtils.Wizard_WarningMessage_Preview();
            }
        }
Exemple #23
0
        //Paste to from the Clipboard
        private void Button_PasteFromClipboard(object sender, RoutedEventArgs e)
        {
            Encoding encoding = Encoding.Default;

            //Return IDText Parent
            string MyIDTextParent = DesignUtils.ReturnCurrentFileIDText();

            //Get Encoding
            encoding = DesignUtils.GetEncodingIDText(MyIDTextParent);

            //Get the File Path
            string FilePath = Directory.GetCurrentDirectory() + "/StorageTextToolbox/Infos/" + MyIDText + ".txt";

            //Paste Argument from the Clipboard
            string OutputText = DesignUtils.PasteArgumentFromClipboard();

            //Update Control
            UpdateControl("SearchWord", OutputText);

            //Update Text File Row Argument
            DesignUtils.CallUpdateTextFileRowArgument(FilePath, MyArgument, OutputText, encoding);
        }
Exemple #24
0
        //Create New TextID
        private void CreateNewIDText(object sender, RoutedEventArgs e)
        {
            Encoding encoding = Encoding.Default;

            //Get the File Path
            string FilePath = Directory.GetCurrentDirectory() + "/StorageTextToolbox/Infos/" + MyIDText + ".txt";

            //Get Encoding
            encoding = DesignUtils.GetEncodingIDText(MyIDText);

            //Clear the Current IDText
            ModelProperty property = this.ModelItem.Properties["IDText"];

            property.SetValue(null);

            //Update IDText
            UpdateIDText();

            //Copy the Arguments, in case there is
            string FilePathPreview = ReturnCurrentFile();

            //File Name
            if (FilePath != null)
            {
                //Update Text File Row Argument
                DesignUtils.CallUpdateTextFileRowArgument(FilePath, "FileName", FilePathPreview, encoding);
            }

            //Encoding
            string MyEncoding = ReturnEncoding();

            if (MyEncoding != null)
            {
                //Update Text File Row Argument
                DesignUtils.CallUpdateTextFileRowArgument(FilePath, "Encoding", MyEncoding, encoding);
            }
        }
        //Button Open Preview
        private void Button_OpenPreview(object sender, RoutedEventArgs e)
        {
            Encoding encoding = Encoding.Default;

            //Return IDText Parent
            string MyIDTextParent = DesignUtils.ReturnCurrentFileIDText();

            //Get Encoding
            encoding = DesignUtils.GetEncodingIDText(MyIDTextParent);

            //Get the File Path
            string FilePath = Directory.GetCurrentDirectory() + "/StorageTextToolbox/Infos/" + MyIDText + ".txt";

            #region Open Preview Extraction

            //Read Text File
            string Source = System.IO.File.ReadAllText(FilePath, encoding);

            //Check if all Parameters are in the File
            string[] searchWords = { "Beg Words" + Utils.DefaultSeparator(), "Regex Parameter" + Utils.DefaultSeparator() };
            double   PercResults = Utils.FindWordsInString(Source, searchWords, false);

            //Case all Parameters are found
            if (PercResults == 1)
            {
                //Open Form Preview Extraction
                DesignUtils.CallformPreviewExtraction(MyIDText, "Extract Text Between Two Anchor Words", MyIDTextParent, encoding);
            }
            else
            {
                //Error Message
                MessageBox.Show("Please fill in all arguments", "Validation Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }

            #endregion
        }
        //Run Extraction
        private void RunExtraction(string Label)
        {
            string Source    = null;
            string inputText = null;

            //Read Data from IDTextFile

            //string FilePath = Directory.GetCurrentDirectory() + "/StorageTextToolbox/CurrentFile.txt";
            string FilePath = DicArgumentsParent["FileName"];

            if (File.Exists(FilePath) == true)
            {
                //Source = System.IO.File.ReadAllText(FilePath);

                //Get Data from the Text File
                inputText = System.IO.File.ReadAllText(FilePath, encoding);

                //Display Result
                this.DisplaySource.Text = inputText;

                //Add Dummy last line to InputText
                inputText += Environment.NewLine;
            }

            #region Variable Declarations

            string[] begWords            = null;
            string[] endWords            = null;
            string   regexParameterText  = null;
            string   ArrayText           = null;
            string[] anchorText          = null;
            string[] anchorWords         = null;
            string   anchorTextParamText = null;
            string[] OutputResults       = null;

            int LinesAbove = 0;
            int LinesBelow = 0;
            int NumLines   = 0;

            string MyOccurenceParameter = null;
            int    MyOccurencePosition  = 0;

            string FilePathforPreview = null;
            string TextResult         = null;

            string[] inputArray = null;

            #endregion

            #region Run Extraction
            switch (Label)
            {
                #region Extract Text Between Two Anchor Words
            case "Extract Text Between Two Anchor Words":

                //Load Arguments from Dictionary

                //Beg Words
                ArrayText = DicArguments["Beg Words"];
                begWords  = DesignUtils.ConvertStringToArray(ArrayText, false);

                //End Words
                if (DicArguments.ContainsKey("End Words") == true)
                {
                    ArrayText = DicArguments["End Words"];

                    //DicArguments.TryGetValue("End Words", out ArrayText);
                    endWords = DesignUtils.ConvertStringToArray(ArrayText, false);
                }
                else
                {
                    //Null Array
                    endWords = null;
                }

                //Regex Parameter
                regexParameterText = DicArguments["Regex Parameter"];

                //Run Extraction
                OutputResults = CallExtractions.CallExtractTextBetweenTwoAnchorWords(inputText, begWords, endWords, regexParameterText, false, false);

                break;

                #endregion

                #region Extract All Lines Below Anchor Words
            case "Extract All Lines Below Anchor Words":

                //Load Arguments from Dictionary
                anchorTextParamText = DicArguments["Anchor Words Parameter"];
                ArrayText           = DicArguments["Anchor Words"];

                //Split the Items
                anchorText = DesignUtils.ConvertStringToArray(ArrayText, false);

                //Run Extraction
                OutputResults = CallExtractions.CallExtractAllLinesBelowAnchorText(inputText, anchorText, anchorTextParamText, false, false);

                break;
                #endregion

                #region Extract Text Above Anchor Words
            case "Extract Text Above Anchor Words":

                //Load Arguments from Dictionary
                anchorTextParamText = DicArguments["Anchor Words Parameter"];
                ArrayText           = DicArguments["Anchor Words"];
                //Split the Items
                anchorWords = DesignUtils.ConvertStringToArray(ArrayText, false);

                LinesAbove = Convert.ToInt32(DicArguments["Lines Above"]);
                NumLines   = Convert.ToInt32(DicArguments["Number of Lines"]);

                //Run Extraction
                OutputResults = CallExtractions.CallExtractTextAboveAnchorWords(inputText, anchorWords, anchorTextParamText, LinesAbove, NumLines, false, false);

                break;

                #endregion

                #region Extract Text Below Anchor Words
            case "Extract Text Below Anchor Words":

                //Load Arguments from Dictionary
                anchorTextParamText = DicArguments["Anchor Words Parameter"];

                ArrayText = DicArguments["Anchor Words"];
                //Split the Items
                anchorWords = DesignUtils.ConvertStringToArray(ArrayText, false);

                LinesBelow = Convert.ToInt32(DicArguments["Lines Below"]);
                NumLines   = Convert.ToInt32(DicArguments["Number of Lines"]);

                //Run Extraction
                OutputResults = CallExtractions.CallExtractTextBelowAnchorWords(inputText, anchorWords, anchorTextParamText, LinesBelow, NumLines, true, true);


                break;
                #endregion

                #region Extract Text Until White Space
            case "Extract Text Until White Space":

                //Load Arguments from Dictionary
                ArrayText = DicArguments["Anchor Words"];
                //Split the Items
                anchorWords = DesignUtils.ConvertStringToArray(ArrayText, false);

                //Run Extraction
                OutputResults = CallExtractions.CallExtractAllCharactersUntilWhiteSpace(inputText, anchorWords, false, false);

                break;


                #endregion

                #region Extract Text Until Next Letter
            case "Extract Text Until Next Letter":

                //Load Arguments from Dictionary
                ArrayText = DicArguments["Anchor Words"];
                //Split the Items
                anchorWords = DesignUtils.ConvertStringToArray(ArrayText, false);

                //Run Extraction
                OutputResults = CallExtractions.CallExtractAllCharactersUntilLetterCharacter(inputText, anchorWords, false);

                break;

                #endregion

                #region Remove Words
            case "Remove Words":

                //Load Arguments from Dictionary
                ArrayText = DicArguments["Words"];

                //Split the Items
                anchorWords = DesignUtils.ConvertStringToArray(ArrayText, false);

                //Occurence Parameter
                MyOccurenceParameter = DicArguments["Occurence Parameter"];

                //Occurence Position
                if (DicArguments.ContainsKey("Occurence Position") == true)
                {
                    MyOccurencePosition = Convert.ToInt32(DicArguments["Occurence Position"]);
                }

                //Run Extraction
                TextResult = Utils.RemoveWordsFromText(inputText, anchorWords, MyOccurenceParameter, MyOccurencePosition, false);

                //Display Result
                this.DisplayResult.Text = TextResult;

                //Hide Controls
                ResultsMatches_Label.Visible = false;
                ResultsMatches.Visible       = false;
                SelectResult_Label.Visible   = false;
                SelectResult.Visible         = false;

                break;
                #endregion

                #region Replace Words
            case "Replace Words":

                //Load Arguments from Dictionary
                ArrayText = DicArguments["Search Words"];

                //Split the Items
                anchorWords = DesignUtils.ConvertStringToArray(ArrayText, false);

                string ReplacedWords = DicArguments["Replaced Word"];

                //Occurence Parameter
                MyOccurenceParameter = DicArguments["Occurence Parameter"];

                //Occurence Position
                if (DicArguments.ContainsKey("Occurence Position") == true)
                {
                    MyOccurencePosition = Convert.ToInt32(DicArguments["Occurence Position"]);
                }

                //Run Extraction
                TextResult = Utils.ReplaceWordsFromText(inputText, anchorWords, ReplacedWords, MyOccurenceParameter, MyOccurencePosition, false);

                //Display Result
                this.DisplayResult.Text = TextResult;

                //Hide Controls
                ResultsMatches_Label.Visible = false;
                ResultsMatches.Visible       = false;
                SelectResult_Label.Visible   = false;
                SelectResult.Visible         = false;

                break;

                #endregion

                #region Split Text Uneven Blank Spaces
            case "Split text Uneven Blank Spaces":

                //Load Arguments from Dictionary
                FilePathforPreview = DicArguments["FileName"];
                inputText          = System.IO.File.ReadAllText(FilePathforPreview, encoding);

                //Null Limit
                int nullLimit = Convert.ToInt32(DicArguments["Null Limit"]);

                //Suppress Null Values
                string SuppressNullValues  = DicArguments["Suppress Null Values"];
                bool   bSuppressNullValues = false;
                if (SuppressNullValues == "True")
                {
                    bSuppressNullValues = true;
                }
                else if (SuppressNullValues == "False")
                {
                    bSuppressNullValues = false;
                }

                //Run Extraction
                OutputResults = Utils.SplitTextBigSpaces(inputText, nullLimit, bSuppressNullValues, false);

                break;

                #endregion

                #region Remove Empty Rows
            case "Remove Empty Rows":

                FilePathforPreview = DicArguments["FileName"];
                inputText          = System.IO.File.ReadAllText(FilePathforPreview, encoding);

                //Run Extraction
                TextResult = Utils.TextRemoveEmptyRows(inputText);

                //Display Result
                this.DisplayResult.Text = TextResult;

                //Hide Controls
                ResultsMatches_Label.Visible = false;
                ResultsMatches.Visible       = false;
                SelectResult_Label.Visible   = false;
                SelectResult.Visible         = false;

                break;

                #endregion

                #region Read Text File Encoding
            case "Read Text File Encoding":
            case "Text Application Scope":

                ////File Name
                //FilePath = DicArguments["FileName"];

                ////Encoding
                //string strEncoding = DicArguments["Encoding"];

                ////Run Extraction
                //TextResult = Utils.ReadTextFileEncoding(FilePath, strEncoding,false);

                ////Display Result
                //this.DisplayResult.Text = TextResult;

                //Remove TAG Source
                this.tabText.TabPages.Remove(tabResults);

                //Hide Controls
                ResultsMatches_Label.Visible = false;
                ResultsMatches.Visible       = false;
                SelectResult_Label.Visible   = false;
                SelectResult.Visible         = false;

                break;

                #endregion

                #region Extract Text until Blank Line
            case "Extract Text until Blank Line":

                //Anchor Words
                ArrayText   = DicArguments["Anchor Words"];
                anchorWords = DesignUtils.ConvertStringToArray(ArrayText, false);

                //Anchor Words Parameter
                anchorTextParamText = DicArguments["Anchor Words Parameter"];

                //Direction
                string Direction = DicArguments["Direction"];

                string IncludeAnchorWordsParameter  = DicArguments["Include Anchor Words Parameter"];
                bool   bIncludeAnchorWordsParameter = false;

                if (IncludeAnchorWordsParameter == "True")
                {
                    bIncludeAnchorWordsParameter = true;
                }
                else if (IncludeAnchorWordsParameter == "False")
                {
                    bIncludeAnchorWordsParameter = false;
                }

                //Run Extraction
                OutputResults = CallExtractions.CallExtractTextUntilBlankLine(inputText, anchorWords, anchorTextParamText, Direction, bIncludeAnchorWordsParameter, false, false);

                break;

                #endregion

                #region Split Text New Lines
            case "Split Text New Lines":

                //Run Extraction
                OutputResults = Utils.SplitTextNewLine(inputText);

                break;

                #endregion

                #region Split Text By Blank Lines

            case "Split Text By Blank Lines":

                //Run Extraction
                OutputResults = Utils.SplitTextByBlankLines(inputText);


                break;

                #endregion

                #region Find Array Items
            case "Find Array Items":

                //File Path for Preview
                FilePath  = DicArguments["FileName"];
                inputText = System.IO.File.ReadAllText(FilePath, encoding);

                //Input Array
                inputArray = Utils.SplitTextByBlankLines(inputText);

                //Anchor Words
                ArrayText = DicArguments["Filter Words"];
                string [] filterWords = DesignUtils.ConvertStringToArray(ArrayText, false);

                //Anchor Words Parameter
                anchorTextParamText = DicArguments["Anchor Words Parameter"];

                //Run Extraction
                OutputResults = CallExtractions.CallFindArrayItems(inputArray, filterWords, anchorTextParamText, false);

                break;
                #endregion

                #region Match Item in Array
            case "Match Item in Array":

                //File Path for Preview
                FilePath  = DicArguments["FileName"];
                inputText = System.IO.File.ReadAllText(FilePath, encoding);

                //Input Array
                inputArray = Utils.SplitTextNewLine(inputText);

                ArrayText = DicArguments["SearchWord"];

                string[] searchWords = DesignUtils.ConvertStringToArray(ArrayText, false);

                bool isFound = Utils.MatchItemInArrayOfStrings(inputArray, searchWords, false);

                //Display Result
                this.DisplayResult.Text = isFound.ToString();

                //Hide Controls
                ResultsMatches_Label.Visible = false;
                ResultsMatches.Visible       = false;
                SelectResult_Label.Visible   = false;
                SelectResult.Visible         = false;

                break;

                #endregion
            }
            #endregion

            #region Display Results
            if (OutputResults != null)
            {
                //Get Results Counter
                int ResultsCounter = OutputResults.Length;

                //Case Items are found
                if (ResultsCounter > 0)
                {
                    //Results Counter
                    this.ResultsMatches.Text = ResultsCounter.ToString();

                    //Load the ComboBox
                    for (int i = 0; i < ResultsCounter; i++)
                    {
                        //Add to the ComboBox
                        SelectResult.Items.Add(i + 1);

                        //Add to the Dic Results
                        DicResults.Add((i + 1), OutputResults[i]);
                    }

                    //Set Default value case item is found
                    this.SelectResult.SelectedItem = 1;
                }
                //Case items are not found
                else
                {
                    //Matches
                    this.ResultsMatches.Text = "0";

                    //Hide Select Result
                    SelectResult_Label.Visible = false;
                    SelectResult.Visible       = false;
                }
            }

            #endregion
        }
        //they asked to pop up the Package Configurations dialog, so replace the Microsoft functionality so we can control the popup form
        void cmdEvent_BeforeExecute(string Guid, int ID, object CustomIn, object CustomOut, ref bool CancelDefault)
        {
            if (Enabled)
            {
                try
                {
                    if (this.ApplicationObject.ActiveWindow == null || this.ApplicationObject.ActiveWindow.ProjectItem == null)
                    {
                        return;
                    }
                    ProjectItem pi = this.ApplicationObject.ActiveWindow.ProjectItem;
                    if (!pi.Name.ToLower().EndsWith(".dtsx"))
                    {
                        return;
                    }

                    IDesignerHost designer = this.ApplicationObject.ActiveWindow.Object as IDesignerHost;
                    if (designer == null)
                    {
                        return;
                    }
                    EditorWindow win     = (EditorWindow)designer.GetService(typeof(Microsoft.DataWarehouse.ComponentModel.IComponentNavigator));
                    Package      package = (Package)win.PropertiesLinkComponent;
                    this.packageForFixButton        = package;
                    this.pathForPackageForFixButton = pi.get_FileNames(1);

                    DtsConfigurationsForm form = new DtsConfigurationsForm(package);
                    if (win.SelectedIndex == 0)
                    {
                        //control flow
                        EditorWindow.EditorView        view     = win.SelectedView;
                        System.Reflection.BindingFlags getflags = System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.GetProperty | System.Reflection.BindingFlags.DeclaredOnly | System.Reflection.BindingFlags.Instance;
                        Control viewControl = (Control)view.GetType().InvokeMember("ViewControl", getflags, null, view, null);

                        IWin32Window parentWin;
                        #if DENALI || SQL2014
                        parentWin = viewControl;
                        #else
                        DdsDiagramHostControl diagram = viewControl.Controls["panel1"].Controls["ddsDiagramHostControl1"] as DdsDiagramHostControl;
                        if (diagram == null || diagram.DDS == null)
                        {
                            return;
                        }
                        parentWin = diagram.DDS;
                        #endif

                        Button  editSelectedButton = (Button)form.Controls["editSelectedConfiguration"];
                        Control packageConfigurationsGridControl1 = form.Controls["packageConfigurationsGridControl1"];
                        Button  btnRelativePaths = new Button();
                        btnRelativePaths.Text   = "Fix All Relative Paths";
                        btnRelativePaths.Width  = 140;
                        btnRelativePaths.Left   = packageConfigurationsGridControl1.Left;
                        btnRelativePaths.Top    = editSelectedButton.Top;
                        btnRelativePaths.Height = editSelectedButton.Height;
                        btnRelativePaths.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
                        btnRelativePaths.Click += new EventHandler(btnRelativePaths_Click);
                        form.Controls.Add(btnRelativePaths);

                        if (DesignUtils.ShowDialog((Form)form, parentWin, (IServiceProvider)package.Site) == DialogResult.OK)
                        {
                            SSISHelpers.MarkPackageDirty(package);
                        }

                        CancelDefault = true;
                    }
                }
                catch (Exception ex)
                {
                    System.Windows.Forms.MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace);
                }
            }
        }
Exemple #28
0
        public void Button_RefreshCurrentFile()
        {
            //Get Data from Control
            //string CurrentExcelFilePath = this.FilePath.Expression.ToString();
            string CurrentTextFilePath = ReturnCurrentFile();

            //Case it is a Variable
            if (CurrentTextFilePath == "1.5: VisualBasicValue<String>")
            {
                MessageBox.Show("File Path as Variable" + Environment.NewLine + "Please select Text file to use functionality ", "Select Text File", MessageBoxButton.OK, MessageBoxImage.Warning);

                //Exit the Procedure
                return;
            }

            //If Current File is not found, exit the procedure
            if (File.Exists(CurrentTextFilePath) == false)
            {
                //Error Message
                MessageBox.Show("The Preview file cannt be found:" + Environment.NewLine + CurrentTextFilePath, "Validation Error", MessageBoxButton.OK, MessageBoxImage.Warning);

                //Exit the Procedure
                return;
            }

            //In case file is found
            if (CurrentTextFilePath != null)
            {
                #region Update Text Files
                //Get the full file path
                string filePath = Directory.GetCurrentDirectory() + "/StorageTextToolbox/FileNames/" + Path.GetFileNameWithoutExtension(CurrentTextFilePath) + ".txt";

                //Check if file exists
                bool bExists = File.Exists(filePath);

                //Case File Exists
                switch (bExists)
                {
                //File Exists
                case true:

                    //Get the File Path
                    string FilePath = Directory.GetCurrentDirectory() + "/StorageTextToolbox/Infos/" + MyIDText + ".txt";

                    //Get Current File
                    string CurrentFile = System.IO.File.ReadAllText(Directory.GetCurrentDirectory() + "/StorageTextToolbox/FileNames/" + Path.GetFileNameWithoutExtension(CurrentTextFilePath) + ".txt");

                    //Get Item from the ComboBox
                    string MyEncoding = ReturnEncoding();

                    if (MyEncoding != null)
                    {
                        Encoding encoding = Utils.ConvertStringToEncoding(MyEncoding);

                        //Update Text File Row Argument
                        MyArgument = "FileName";
                        DesignUtils.CallUpdateTextFileRowArgument(FilePath, MyArgument, CurrentFile, encoding);
                    }

                    break;

                //Case File does not exists
                case false:
                    //Warning Message
                    MessageBox.Show("This funcionality is not available", "File does not exists", MessageBoxButton.OK, MessageBoxImage.Warning);
                    break;
                }
            }
            #endregion
            else
            {
                //Error Message
                MessageBox.Show("Please select template file", "Select Text File", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
        }
        public void Button_RefreshCurrentFile()
        {
            //Get Data from Control
            string CurrentTextFilePath = ReturnCurrentFile();

            //Case it is a Variable
            if (CurrentTextFilePath == "1.5: VisualBasicValue<String>")
            {
                //Error Message
                MessageBox.Show("File Path as Variable" + Environment.NewLine + "Please select Text file to use functionality ", "Select Text File", MessageBoxButton.OK, MessageBoxImage.Warning);

                //Exit the Procedure
                return;
            }

            //If Current File is not found, exit the procedure
            if (File.Exists(CurrentTextFilePath) == false)
            {
                //Error Message
                MessageBox.Show("The Preview file cannt be found:" + Environment.NewLine + CurrentTextFilePath, "Validation Error", MessageBoxButton.OK, MessageBoxImage.Warning);

                //Exit the Procedure
                return;
            }

            //In case file is found
            if (CurrentTextFilePath != null)
            {
                #region Update Text Files
                //Get the full file path
                string filePath = Directory.GetCurrentDirectory() + "/StorageTextToolbox/FileNames/" + Path.GetFileNameWithoutExtension(CurrentTextFilePath) + ".txt";

                //Check if file exists
                bool bExists = File.Exists(filePath);

                //Case file does not exists, create it!
                if (bExists == false)
                {
                    System.IO.File.WriteAllText(filePath, CurrentTextFilePath);
                }

                ////Case File Exists
                //switch (bExists)
                //{

                //    //File Exists
                //    case true:

                #region Update CurrentFile.txt

                //Open File
                string CurrentFile = System.IO.File.ReadAllText(Directory.GetCurrentDirectory() + "/StorageTextToolbox/FileNames/" + Path.GetFileNameWithoutExtension(CurrentTextFilePath) + ".txt");

                //Write Text File: Current File
                System.IO.File.WriteAllText(Directory.GetCurrentDirectory() + "/StorageTextToolbox/CurrentFile.txt", CurrentFile);

                //Write Text File: IDText
                System.IO.File.WriteAllText(Directory.GetCurrentDirectory() + "/StorageTextToolbox/CurrentFileIDText.txt", MyIDText);

                #endregion

                //Get Current Text File
                CurrentFile = System.IO.File.ReadAllText(Directory.GetCurrentDirectory() + "/StorageTextToolbox/CurrentFile.txt");

                //if (CurrentTextFilePath == DesignUtils.TrimFilePath(CurrentFile, Directory.GetCurrentDirectory()))
                //{
                //this.btn.Background = new SolidColorBrush(Colors.DarkGreen);

                //Write to Text File: Updated done!
                System.IO.File.WriteAllText(Directory.GetCurrentDirectory() + "/StorageTextToolbox/CurrentFileUpdated.txt", "-1");

                //Get the File Path
                string FilePath = Directory.GetCurrentDirectory() + "/StorageTextToolbox/Infos/" + MyIDText + ".txt";

                //If false create it
                if (File.Exists(FilePath) == false)
                {
                    //Create File
                    System.IO.File.WriteAllText(FilePath, "");
                }

                //Update Text File Row Argument

                //Get Item from the ComboBox
                string MyEncoding = ReturnEncoding();

                if (MyEncoding != null)
                {
                    Encoding encoding = Utils.ConvertStringToEncoding(MyEncoding);

                    MyArgument = "FileName";
                    DesignUtils.CallUpdateTextFileRowArgument(FilePath, MyArgument, CurrentFile, encoding);
                }

                //Hide the Button
                btnWarning.Visibility = Visibility.Hidden;

                //}
                //else
                //{
                //    //this.btn.Background = new SolidColorBrush(Colors.IndianRed);
                //}

                //break;

                //    //Case File does not exists
                //    case false:
                //        //Warning Message
                //        MessageBox.Show("This funcionality is not available", "File does not exists", MessageBoxButton.OK, MessageBoxImage.Warning);
                //        break;

                //}
            }
            #endregion
            else
            {
                //Error Message
                MessageBox.Show("Please select template file", "Select Text File", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
        }
        //Setup Wizard Button
        private void CallButton_SetupWizard()
        {
            //Check if Current File is Updated
            string bUpdated = System.IO.File.ReadAllText(Directory.GetCurrentDirectory() + "/StorageTextToolbox/CurrentFileUpdated.txt");

            if (bUpdated == "-1")
            {
                #region Build Context Menu
                //Start Context Menu
                ContextMenu cm = new ContextMenu();

                #region Create New IDText
                //Create New IDText
                System.Windows.Controls.MenuItem menuCreateNewIDText = new System.Windows.Controls.MenuItem();

                menuCreateNewIDText.Header  = "Create New ID";
                menuCreateNewIDText.Click  += CreateNewIDText;
                menuCreateNewIDText.ToolTip = "Create New IDText";
                //Add Icon to the uri_menuItem
                var uri_CreateNewIDText    = new System.Uri("https://img.icons8.com/officexs/20/000000/add-file.png");
                var bitmap_CreateNewIDText = new BitmapImage(uri_CreateNewIDText);
                var image_CreateNewIDText  = new Image();
                image_CreateNewIDText.Source = bitmap_CreateNewIDText;
                menuCreateNewIDText.Icon     = image_CreateNewIDText;

                cm.Items.Add(menuCreateNewIDText);
                #endregion

                //Add Separator
                cm.Items.Add(new Separator());

                #region Paste from the Clipboard
                //Paste from the Clipboard

                //Get Text from the Clipboard
                string ClipboardText = Clipboard.GetText();

                if (ClipboardText != null)
                {
                    System.Windows.Controls.MenuItem menuPaste = new System.Windows.Controls.MenuItem();

                    menuPaste.Header  = "Paste";
                    menuPaste.Click  += Button_PasteFromClipboard;
                    menuPaste.ToolTip = $"Paste '{ClipboardText}' from the Clipboard to the Control";
                    //Add Icon to the uri_menuItem
                    var uri_menuPaste    = new System.Uri("https://img.icons8.com/cotton/20/000000/clipboard--v5.png");
                    var bitmap_menuPaste = new BitmapImage(uri_menuPaste);
                    var image_menuPaste  = new Image();
                    image_menuPaste.Source = bitmap_menuPaste;
                    menuPaste.Icon         = image_menuPaste;

                    cm.Items.Add(menuPaste);
                }

                #endregion

                #region Wizard
                //Wizard
                System.Windows.Controls.MenuItem menuWizard = new System.Windows.Controls.MenuItem();

                //CurrentFile
                string FilePath   = Directory.GetCurrentDirectory() + "/StorageTextToolbox/CurrentFile.txt";
                string FilePeview = System.IO.File.ReadAllText(FilePath);

                menuWizard.Header  = "Wizard";
                menuWizard.Click  += Button_OpenFormSelectData;
                menuWizard.ToolTip = "Select Words from Preview Text File '" + FilePeview + "'";
                //Add Icon to the uri_menuItem
                var uri_menuWizard    = new System.Uri("https://img.icons8.com/officexs/20/000000/edit-file.png");
                var bitmap_menuWizard = new BitmapImage(uri_menuWizard);
                var image_menuWizard  = new Image();
                image_menuWizard.Source = bitmap_menuWizard;
                menuWizard.Icon         = image_menuWizard;

                cm.Items.Add(menuWizard);
                #endregion

                #region Preview
                //Preview
                System.Windows.Controls.MenuItem menuPreview = new System.Windows.Controls.MenuItem();

                menuPreview.Header  = "Preview";
                menuPreview.Click  += Button_OpenPreview;
                menuPreview.ToolTip = "Preview Data Extraction With Current Activity Arguments";
                //Add Icon to the uri_menuItem
                var uri_menuPreview    = new System.Uri("https://img.icons8.com/officexs/20/000000/new-file.png");
                var bitmap_menuPreview = new BitmapImage(uri_menuPreview);
                var image_menuPreview  = new Image();
                image_menuPreview.Source = bitmap_menuPreview;
                menuPreview.Icon         = image_menuPreview;

                cm.Items.Add(menuPreview);
                #endregion

                //Open the Menu
                cm.IsOpen = true;

                #endregion
            }
            else
            {
                //Wizard Button: Warning Message: Wizard & Preview
                DesignUtils.Wizard_WarningMessage_Wizard_Preview();
            }
        }