public ExportMacroWindow(MacroRecorderWindow window, MainWindow mainWindow)
 {
     this.InitializeComponent();
     this.mOperationWindow   = window;
     this.ParentWindow       = mainWindow;
     this.mScriptsStackPanel = this.mScriptsListScrollbar.Content as StackPanel;
 }
Esempio n. 2
0
        private void ScriptSettingsImg_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            this.mMacroRecorderWindow.mOverlayGrid.Visibility = Visibility.Visible;
            MacroRecording macroRecording = MacroGraph.Instance.Vertices.Cast <MacroRecording>().Where <MacroRecording>((Func <MacroRecording, bool>)(macro => macro.Equals(this.mRecording))).FirstOrDefault <MacroRecording>();
            MacroRecording mRecording     = this.mRecording;

            if ((mRecording != null ? (mRecording.RecordingType == RecordingTypes.MultiRecording ? 1 : 0) : 0) != 0)
            {
                ClientStats.SendMiscellaneousStatsAsync("MacroOperations", RegistryManager.Instance.UserGuid, RegistryManager.Instance.ClientVersion, "merge_macro_edit", (string)null, (string)null, (string)null, (string)null, (string)null, "Android");
                if (this.mMacroRecorderWindow.mMergeMacroWindow == null)
                {
                    MacroRecorderWindow macroRecorderWindow = this.mMacroRecorderWindow;
                    MergeMacroWindow    mergeMacroWindow    = new MergeMacroWindow(this.mMacroRecorderWindow, this.ParentWindow);
                    mergeMacroWindow.Owner = (Window)this.ParentWindow;
                    macroRecorderWindow.mMergeMacroWindow = mergeMacroWindow;
                }
                this.mMacroRecorderWindow.mMergeMacroWindow.Init(macroRecording, this);
                this.mMacroRecorderWindow.mMergeMacroWindow.Show();
            }
            else
            {
                ClientStats.SendMiscellaneousStatsAsync("MacroOperations", RegistryManager.Instance.UserGuid, RegistryManager.Instance.ClientVersion, "macro_window_settings", (string)null, this.mRecording.RecordingType.ToString(), (string)null, (string)null, (string)null, "Android");
                if (this.mMacroSettingsWindow == null || this.mMacroSettingsWindow.IsClosed)
                {
                    this.mMacroSettingsWindow = new MacroSettingsWindow(this.ParentWindow, macroRecording, this.mMacroRecorderWindow);
                }
                this.mMacroSettingsWindow.ShowDialog();
            }
        }
        internal void Init()
        {
            bool isSingleRecording = this.ParentWindow.MacroRecorderWindow.mRenamingMacrosList.Count == 1;

            try
            {
                this.mInited = false;
                this.mScriptsStackPanel.Children.Clear();
                foreach (MacroRecording mRenamingMacros in this.ParentWindow.MacroRecorderWindow.mRenamingMacrosList)
                {
                    string suggestedName1;
                    ImportMacroScriptsControl stackPanelAndDict = this.AddRecordingToStackPanelAndDict(mRenamingMacros, isSingleRecording, out suggestedName1);
                    if (mRenamingMacros.RecordingType == RecordingTypes.MultiRecording)
                    {
                        bool?multiMacroAsUnified = this.mOperationWindow.mImportMultiMacroAsUnified;
                        if (0 == (multiMacroAsUnified.GetValueOrDefault() ? 1 : 0) & multiMacroAsUnified.HasValue)
                        {
                            stackPanelAndDict.mDependentScriptsMsg.Visibility   = Visibility.Visible;
                            stackPanelAndDict.mDependentScriptsPanel.Visibility = Visibility.Visible;
                            stackPanelAndDict.mDependentScriptsPanel.Children.Clear();
                            foreach (string sourceRecording in mRenamingMacros.SourceRecordings)
                            {
                                MacroRecording macroRecording         = JsonConvert.DeserializeObject <MacroRecording>(sourceRecording, Utils.GetSerializerSettings());
                                string         dependentRecordingName = MacroRecorderWindow.GetDependentRecordingName(suggestedName1, macroRecording.Name);
                                string         suggestedName2         = !MacroGraph.Instance.Vertices.Cast <MacroRecording>().Select <MacroRecording, string>((Func <MacroRecording, string>)(macro => macro.Name)).Contains <string>(dependentRecordingName.ToLower(CultureInfo.InvariantCulture).Trim()) ? dependentRecordingName : CommonHandlers.GetMacroName(dependentRecordingName);
                                CustomTextBox  customTextBox          = new CustomTextBox();
                                customTextBox.Height = 24.0;
                                customTextBox.HorizontalAlignment = HorizontalAlignment.Left;
                                customTextBox.Margin     = new Thickness(0.0, 5.0, 0.0, 0.0);
                                customTextBox.Text       = this.ValidateSuggestedName(suggestedName2);
                                customTextBox.Visibility = Visibility.Visible;
                                customTextBox.IsEnabled  = false;
                                CustomTextBox index = customTextBox;
                                stackPanelAndDict.mDependentScriptsPanel.Children.Add((UIElement)index);
                                this.mDependentRecordingDict[index] = macroRecording;
                            }
                        }
                    }
                }
                this.mNumberOfFilesSelectedForImport = 0;
            }
            catch (Exception ex)
            {
                Logger.Error("Error in import window init err: " + ex.ToString());
            }
            this.mInited = true;
            if (isSingleRecording)
            {
                this.mSelectAllBtn.Visibility = Visibility.Hidden;
            }
            this.mSelectAllBtn.IsChecked = new bool?(true);
            this.SelectAllBtn_Click((object)null, (RoutedEventArgs)null);
        }
        internal void TextChanged(object sender, TextChangedEventArgs e)
        {
            if (!this.mInited)
            {
                return;
            }
            ImportMacroScriptsControl macroItemGrandchild = this.GetScriptControlFromMacroItemGrandchild((object)(sender as FrameworkElement).Parent);
            string text = (sender as CustomTextBox).Text;

            foreach (UIElement child in macroItemGrandchild.mDependentScriptsPanel.Children)
            {
                CustomTextBox index = child as CustomTextBox;
                index.Text = MacroRecorderWindow.GetDependentRecordingName(text, this.mDependentRecordingDict[index].Name);
            }
        }
Esempio n. 5
0
 internal SingleMacroControl(
     MainWindow parentWindow,
     MacroRecording record,
     MacroRecorderWindow recorderWindow)
 {
     this.InitializeComponent();
     this.mRecording           = record;
     this.ParentWindow         = parentWindow;
     this.mMacroRecorderWindow = recorderWindow;
     InputMethod.SetIsInputMethodEnabled((DependencyObject)this.mMacroShortcutTextBox, false);
     this.mTimestamp.Text            = DateTime.ParseExact(this.mRecording.TimeCreated, "yyyyMMddTHHmmss", (IFormatProvider)CultureInfo.InvariantCulture, DateTimeStyles.AssumeLocal).ToString("yyyy.MM.dd HH.mm.ss", (IFormatProvider)CultureInfo.InvariantCulture);
     this.mScriptName.Text           = this.mRecording.Name;
     this.mMacroShortcutTextBox.Text = IMAPKeys.GetStringForUI(this.mRecording.Shortcut);
     this.mScriptName.ToolTip        = (object)this.mScriptName.Text;
     if (record.RecordingType == RecordingTypes.MultiRecording)
     {
         this.mScriptSettingsImg.Visibility      = Visibility.Collapsed;
         this.mMergeScriptSettingsImg.Visibility = Visibility.Visible;
     }
     if (!string.IsNullOrEmpty(this.mRecording.Shortcut))
     {
         this.mMacroShortcutTextBox.Tag = (object)IMAPKeys.GetStringForFile(IMAPKeys.mDictKeys.FirstOrDefault <KeyValuePair <Key, string> >((Func <KeyValuePair <Key, string>, bool>)(x => x.Value == this.mRecording.Shortcut)).Key);
         MainWindow.sMacroMapping[this.mMacroShortcutTextBox.Tag.ToString()] = this.mScriptName.Text;
     }
     else
     {
         this.mMacroShortcutTextBox.Tag = (object)"";
     }
     this.IsBookmarked = BlueStacksUIUtils.CheckIfMacroScriptBookmarked(this.mRecording.Name);
     if (record.PlayOnStart)
     {
         this.mAutorunImage.Visibility = Visibility.Visible;
     }
     if (this.ParentWindow.mIsMacroPlaying && string.Equals(this.mRecording.Name, this.ParentWindow.mMacroPlaying, StringComparison.InvariantCulture))
     {
         this.ToggleScriptPlayPauseUi(true);
     }
     else
     {
         this.ToggleScriptPlayPauseUi(false);
     }
 }
 public MergeMacroWindow(MacroRecorderWindow window, MainWindow mainWindow)
 {
     this.InitializeComponent();
     this.mMacroRecorderWindow = window;
     this.ParentWindow         = mainWindow;
 }