Esempio n. 1
0
 protected virtual void OnExecuted(ExecutedEventArgs e)
 {
     var handler = Executed;
     if (handler != null) {
         handler(this, e);
     }
 }
Esempio n. 2
0
        private void CmdScoreNoteStartPositionSetAt_Executed(object sender, ExecutedEventArgs e)
        {
            Debug.Assert(e.Parameter != null, "e.Parameter != null");

            var startPosition = (NotePosition)e.Parameter;

            visualizer.Editor.NoteStartPosition = startPosition;

            var atMenuItems = new[] {
                mnuScoreNoteStartPositionAt0, mnuScoreNoteStartPositionAt1, mnuScoreNoteStartPositionAt2,
                mnuScoreNoteStartPositionAt3, mnuScoreNoteStartPositionAt4, mnuScoreNoteStartPositionAt5
            };

            foreach (var it in atMenuItems)
            {
                var commandSource = CommandHelper.FindCommandSource(it);

                Debug.Assert(commandSource != null, nameof(commandSource) + " != null");
                Debug.Assert(commandSource.CommandParameter != null, "commandSource.CommandParameter != null");

                var pos = (NotePosition)commandSource.CommandParameter;

                it.Checked = pos == startPosition;
            }

            tsbScoreNoteStartPosition.Text = DescribedEnumConverter.GetEnumDescription(startPosition);
        }
        private void MC_SaveSimulationResults_Executed(object sender, ExecutedEventArgs e)
        {
            if (_output != null && _newResultsAvailable)
            {
                var input = _simulationInputVM.SimulationInput;
                var store = IsolatedStorageFile.GetUserStoreForApplication();

                if (store.FileExists(input.OutputName + ".zip"))
                {
                    try
                    {
                        using (var zipStream = StreamFinder.GetLocalFilestreamFromSaveFileDialog("zip"))
                        {
                            using (var readStream = StreamFinder.GetFileStream(input.OutputName + ".zip", FileMode.Open))
                            {
                                FileIO.CopyStream(readStream, zipStream);
                            }
                        }
                        logger.Info(() => "Finished copying results to user file.\r");
                    }
                    catch (SecurityException)
                    {
                        logger.Error(() => "Problem exporting results to user file...sorry user :(\r");
                    }
                }
            }
        }
Esempio n. 4
0
        private void CmdScoreNoteModifySpecial_Executed(object sender, ExecutedEventArgs e)
        {
            var hit = (ScoreEditorHitTestResult)e.Parameter;

            if (hit == null || !hit.HitAnyNote)
            {
                return;
            }

            var note = hit.Note;

            Debug.Assert(note.Params != null, "note.Params != null");

            var originalBpm = note.Params.NewBpm;

            var(r, newBpm) = FSpecialNote.VariantBpmRequestInput(this, hit.Bar.Basic.Index, hit.Row, originalBpm);

            if (r == DialogResult.Cancel)
            {
                return;
            }
            note.Params.NewBpm = newBpm;
            InformProjectModified();
            visualizer.Editor.UpdateBarStartTimeText();

            ctxScoreNoteInsertSpecial.DeleteCommandParameter();
            ctxScoreNoteModifySpecial.DeleteCommandParameter();
            ctxScoreNoteDeleteSpecial.DeleteCommandParameter();
        }
Esempio n. 5
0
 private void AdoProxyExecutedEventHandler(ExecutedEventArgs a)
 {
     ThreadContext.Properties["duration"]  = a.Duration.TotalMilliseconds;
     ThreadContext.Properties["sql"]       = RemoveWhiteSpaces(a.Sql);
     ThreadContext.Properties["sqlParams"] = RemoveWhiteSpaces(a.SqlParameters);
     logger.Debug(a.SqlMethod);
 }
        private void CmdToolsTestLaunch_Executed(object sender, ExecutedEventArgs e)
        {
            if (_communication == null)
            {
                return;
            }

            var settings = DirectorSettingsManager.CurrentSettings;

            var endPoint     = _communication.Server.EndPoint;
            var program      = settings.ExternalPreviewerFile;
            var argsTemplate = settings.ExternalPreviwerArgs;
            var args         = argsTemplate
                               .Replace("%port%", endPoint.Port.ToString())
                               .Replace("%server_uri%", $"http://{endPoint}/");

            var programFileInfo = new FileInfo(program);

            var startInfo = new ProcessStartInfo(program, args);

            Debug.Assert(programFileInfo.DirectoryName != null, "programFileInfo.DirectoryName != null");

            startInfo.WorkingDirectory = programFileInfo.DirectoryName;

            var process = Process.Start(startInfo);
        }
        private void CmdToolsTestReload_Executed(object sender, ExecutedEventArgs e)
        {
            if (_communication == null)
            {
                return;
            }

            var tempFileName = Path.GetTempFileName();
            var fileInfo     = new FileInfo(tempFileName);
            var newFileName  = fileInfo.Name.Substring(0, fileInfo.Name.Length - fileInfo.Extension.Length);

            newFileName = "sldproj_" + newFileName + ".sldproj";

            Debug.Assert(fileInfo.DirectoryName != null, "fileInfo.DirectoryName != null");

            tempFileName = Path.Combine(fileInfo.DirectoryName, newFileName);

            var project = visualizer.Editor.Project.Project;

            var writer = ProjectWriter.CreateLatest();

            writer.WriteProject(project, tempFileName);

            var @params = new EditReloadRequestParams {
                BackgroundMusicFile = project.MusicFileName,
                BeatmapFile         = tempFileName,
                BeatmapOffset       = 0,
                BeatmapIndex        = (int)(visualizer.Editor.Difficulty - 1)
            };

            _communication.Client.SendReloadRequest(@params);
        }
Esempio n. 8
0
 private void Bootstrapper_Initialized(object sender, ExecutedEventArgs e)
 {
     if (e.CommandName == "Bootstrapped")
     {
         FrontendModule.Current.DependencyResolver.Rebind <INavigationModel>().To <CustomNavigationModel>();
     }
 }
Esempio n. 9
0
        /// <summary>
        /// Callback when the command has finished execution
        /// </summary>
        /// <param name="sender">event source</param>
        /// <param name="e">event args</param>
        private void OnCommandExecuted(object sender, ExecutedEventArgs e)
        {
            IsLoading = false;

            if (sender == null)
            {
                return;
            }

            ICommand command = sender as ICommand;

            if (command == null)
            {
                return;
            }

            if (!commands.ContainsKey(command))
            {
                return;
            }

            try
            {
                this.commands[command].Invoke(e);
            }
            catch (Exception ex)
            {
                Error = ex;
            }
        }
Esempio n. 10
0
        private static void Bootstrapper_Initialized(object sender, ExecutedEventArgs e)
        {
            if (e.CommandName == "Bootstrapped")
            {
                const string TestGRecaptchaDataSitekey = "6LeTWwwTAAAAADnNmwCb9Rnf41n7UDvgkzs8pYrU";
                const string TestGRecaptchaSecret      = "6LeTWwwTAAAAAOTF9tzmlN0C0xvrrDB6nfamLVDJ";

                var manager            = ConfigManager.GetManager();
                var formsConfigSection = manager.GetSection <FormsConfig>();
                if (formsConfigSection.Parameters[RecaptchaModel.GRecaptchaParameterDataSiteKey] == null)
                {
                    formsConfigSection.Parameters.Add(RecaptchaModel.GRecaptchaParameterDataSiteKey, TestGRecaptchaDataSitekey);
                }

                if (formsConfigSection.Parameters[RecaptchaModel.GRecaptchaParameterSecretKey] == null)
                {
                    formsConfigSection.Parameters.Add(RecaptchaModel.GRecaptchaParameterSecretKey, TestGRecaptchaSecret);
                }

                using (var a = new ElevatedConfigModeRegion())
                {
                    manager.SaveSection(formsConfigSection);
                }
            }
        }
Esempio n. 11
0
 private static void executor_Executed(object sender, ExecutedEventArgs e)
 {
     var executor = sender as IExecutor;
     if (executor == null)
     {
         throw new AnycmdException();
     }
     Console.ForegroundColor = ConsoleColor.Green;
     if (!e.Command.Result.IsSuccess)
     {
         Console.ForegroundColor = ConsoleColor.Red;
     }
     Console.Write("结果:");
     Console.WriteLine(e.Command.Result.Description);
     if (!e.Command.Result.IsSuccess)
     {
         Console.ForegroundColor = ConsoleColor.Green;
     }
     Console.WriteLine(string.Format("开始执行时间:{0}", e.ExecutingOn.ToString()));
     Console.WriteLine(string.Format(
         "完成执行时间:{0}\n本次执行耗时长:{1}",
         e.ExecutedOn.ToString(), e.TimeSpan.ToString()));
     Console.ForegroundColor = ConsoleColor.Yellow;
     Console.WriteLine(string.Format(
         "累计执行{0}条,成功{1}条,失败{2}条",
         executor.SucessCount + executor.FailCount, executor.SucessCount, executor.FailCount));
     Console.ForegroundColor = ConsoleColor.Yellow;
     Console.Write("----------------------------------");
     Console.Write("执行结束");
     Console.Write("----------------------------------");
 }
Esempio n. 12
0
        /// <summary>
        ///   Launches the game, without NVSE.
        /// </summary>
        /// <param name="p_objCommand">The command that is executing.</param>
        /// <param name="p_eeaArguments">
        ///   An <see cref="ExecutedEventArgs
        ///
        ///   <MainForm>
        ///     "/> containing the
        ///     main mod management form.
        /// </param>
        public void LaunchFalloutNVPlain(object p_objCommand, ExecutedEventArgs <MainForm> p_eeaArguments)
        {
            if (PrelaunchCheckOrder())
            {
                if (p_eeaArguments.Argument.HasOpenUtilityWindows)
                {
                    MessageBox.Show("Please close all utility windows before launching fallout");
                    return;
                }
                var command         = File.Exists("falloutNV.exe") ? "falloutNV.exe" : "falloutNVng.exe";
                var booSteamStarted = StartSteam(p_eeaArguments.Argument);

                try
                {
                    var psi = new ProcessStartInfo();
                    if (booSteamStarted && !psi.EnvironmentVariables.ContainsKey("SteamAppID"))
                    {
                        psi.EnvironmentVariables.Add("SteamAppID", GetSteamAppId().ToString());
                    }
                    psi.FileName         = command;
                    psi.UseShellExecute  = false;
                    psi.WorkingDirectory = Path.GetDirectoryName(Path.GetFullPath(command));
                    if (Process.Start(psi) == null)
                    {
                        MessageBox.Show("Failed to launch '" + command + "'");
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Failed to launch '" + command + "'\n" + ex.Message);
                }
            }
        }
        public void UsageTest()
        {
            ExecutedEventArgs executeCallbackArgs = null;
            int executeCallbackCount   = 0;
            int canExecuteChangedCount = 0;

            //Business setup:
            var action = new ActionBM {
                Metadata = new BusinessActionMetadata {
                    ExecuteCallback = delegate(object sender, ExecutedEventArgs args) {
                        executeCallbackArgs = args;
                        executeCallbackCount++;
                    }
                }
            };

            //View setup:
            action.CanExecuteChanged += delegate(object sender, EventArgs args) {
                canExecuteChangedCount++;
            };

            //Test
            ((BusinessActionMetadata)action.Metadata).SetCanExecute("A", false);
            Assert.IsFalse(action.CanExecute);
            action.Execute("Test1");
            Assert.IsNull(executeCallbackArgs);

            ((BusinessActionMetadata)action.Metadata).SetCanExecute("A", true);
            Assert.IsTrue(action.CanExecute);
            action.Execute("Test2");
            Assert.IsNotNull(executeCallbackArgs);
            Assert.AreEqual("Test2", executeCallbackArgs.Parameter);
        }
Esempio n. 14
0
        private void CmdScoreNoteStartPositionSetTo_Executed(object sender, ExecutedEventArgs e)
        {
            if (!visualizer.Editor.HasSelectedNotes)
            {
                return;
            }
            var startPosition = (NotePosition)e.Parameter;
            var notes         = visualizer.Editor.GetSelectedNotes().ToList();

            // By sorting, we ensure to visit hold end after hold start.
            notes.Sort(Note.TimingThenPositionComparison);
            foreach (var note in notes)
            {
                if (!note.Helper.IsHoldEnd)
                {
                    note.Basic.StartPosition = startPosition == NotePosition.Default ? note.Basic.FinishPosition : startPosition;
                    if (note.Helper.IsHoldStart)
                    {
                        // Start position of hold end must be the same as hold start.
                        note.Editor.HoldPair.Basic.StartPosition = note.Basic.StartPosition;
                    }
                }
            }
            InformProjectModified();
            visualizer.Editor.Invalidate();
        }
Esempio n. 15
0
        private static void Bootstrapper_Initialized(object sender, ExecutedEventArgs e)
        {
            if (e.CommandName == "Bootstrapped")
            {
                const string TestGRecaptchaDataSitekey = "6LeTWwwTAAAAADnNmwCb9Rnf41n7UDvgkzs8pYrU";
                const string TestGRecaptchaSecret = "6LeTWwwTAAAAAOTF9tzmlN0C0xvrrDB6nfamLVDJ";

                var manager = ConfigManager.GetManager();
                var formsConfigSection = manager.GetSection<FormsConfig>();
                if (formsConfigSection.Parameters[RecaptchaModel.GRecaptchaParameterDataSiteKey] == null)
                {
                    formsConfigSection.Parameters.Add(RecaptchaModel.GRecaptchaParameterDataSiteKey, TestGRecaptchaDataSitekey);
                }

                if (formsConfigSection.Parameters[RecaptchaModel.GRecaptchaParameterSecretKey] == null)
                {
                    formsConfigSection.Parameters.Add(RecaptchaModel.GRecaptchaParameterSecretKey, TestGRecaptchaSecret);
                }

                using (var a = new ElevatedConfigModeRegion())
                {
                    manager.SaveSection(formsConfigSection);
                }
            }
        }
 /// <summary>
 /// Called when the Bootstrapper is initialized.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="Telerik.Sitefinity.Data.ExecutedEventArgs" /> instance containing the event data.</param>
 private static void OnBootstrapperInitialized(object sender, ExecutedEventArgs e)
 {
     if (e.CommandName == "RegisterRoutes")
     {
         SuperFormsInstaller.RegisterModule();
     }
 }
Esempio n. 17
0
        void Bootstrapper_Initialized(object sender, ExecutedEventArgs e)
        {
            // Register any Resource classes
            Res.RegisterResource <SocialLinkResources>();
            Res.RegisterResource <JobSearchResources>();
            Res.RegisterResource <JobSearchResultsResources>();
            Res.RegisterResource <JobAlertResources>();
            Res.RegisterResource <JobDetailsResources>();
            Res.RegisterResource <LoginStatusExtendedResources>();
            Res.RegisterResource <UsersListExtendedResources>();
            Res.RegisterResource <MapsResources>();
            Res.RegisterResource <JobApplicationResources>();
            Res.RegisterResource <MemberSavedJobsResources>();
            Res.RegisterResource <MemberAppliedJobsResources>();
            Res.RegisterResource <ConsultantResources>();
            Res.RegisterResource <SocialHandlerResources>();
            Res.RegisterResource <JXTNextResumeResources>();

            if (e.CommandName == "Bootstrapped")
            {
                GlobalFilters.Filters.Add(new SocialShareAttribute());
                FrontendModule.Current.DependencyResolver.Rebind <IDynamicContentModel>().To <CustomDynamicContentModel>();
                Config.RegisterSection <InstagramConfig>();
                EventHub.Subscribe <IUnauthorizedPageAccessEvent>(new Telerik.Sitefinity.Services.Events.SitefinityEventHandler <IUnauthorizedPageAccessEvent>(OnUnauthorizedAccess));
            }
        }
Esempio n. 18
0
 private void PreviousPage(object sender, ExecutedEventArgs e)
 {
     Frame.ShowLoading();
     ViewModel.CurrentPage--;
     ViewModel.UpdateSource();
     Frame.HideLoading();
 }
Esempio n. 19
0
        /// <summary>
        ///   Launches the game with a custom command.
        /// </summary>
        /// <param name="p_objCommand">The command that is executing.</param>
        /// <param name="p_eeaArguments">
        ///   An <see cref="ExecutedEventArgs
        ///
        ///   <MainForm>
        ///     "/> containing the
        ///     main mod management form.
        /// </param>
        public void LaunchFalloutNVCustom(object p_objCommand, ExecutedEventArgs <MainForm> p_eeaArguments)
        {
            if (PrelaunchCheckOrder())
            {
                if (p_eeaArguments.Argument.HasOpenUtilityWindows)
                {
                    MessageBox.Show("Please close all utility windows before launching Fallout");
                    return;
                }
                var command = Properties.Settings.Default.falloutNewVegasLaunchCommand;
                var args    = Properties.Settings.Default.falloutNewVegasLaunchCommandArgs;
                if (String.IsNullOrEmpty(command))
                {
                    MessageBox.Show("No custom launch command has been set", "Error");
                    return;
                }

                try
                {
                    var psi = new ProcessStartInfo();
                    psi.Arguments        = args;
                    psi.FileName         = command;
                    psi.WorkingDirectory = Path.GetDirectoryName(Path.GetFullPath(command));
                    if (Process.Start(psi) == null)
                    {
                        MessageBox.Show("Failed to launch '" + command + "'");
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Failed to launch '" + command + "'\n" + ex.Message);
                }
            }
        }
Esempio n. 20
0
        private static void executor_Executed(object sender, ExecutedEventArgs e)
        {
            var executor = sender as IExecutor;

            if (executor == null)
            {
                throw new AnycmdException();
            }
            Console.ForegroundColor = ConsoleColor.Green;
            if (!e.Command.Result.IsSuccess)
            {
                Console.ForegroundColor = ConsoleColor.Red;
            }
            Console.Write("结果:");
            Console.WriteLine(e.Command.Result.Description);
            if (!e.Command.Result.IsSuccess)
            {
                Console.ForegroundColor = ConsoleColor.Green;
            }
            Console.WriteLine(string.Format("开始执行时间:{0}", e.ExecutingOn.ToString()));
            Console.WriteLine(string.Format(
                                  "完成执行时间:{0}\n本次执行耗时长:{1}",
                                  e.ExecutedOn.ToString(), e.TimeSpan.ToString()));
            Console.ForegroundColor = ConsoleColor.Yellow;
            Console.WriteLine(string.Format(
                                  "累计执行{0}条,成功{1}条,失败{2}条",
                                  executor.SucessCount + executor.FailCount, executor.SucessCount, executor.FailCount));
            Console.ForegroundColor = ConsoleColor.Yellow;
            Console.Write("----------------------------------");
            Console.Write("执行结束");
            Console.Write("----------------------------------");
        }
 private static void Bootstrapper_Initialized(object sender, ExecutedEventArgs e)
 {
     if (e.CommandName == "Bootstrapped")
     {
         SystemManager.ApplicationStart += SystemManager_ApplicationStart;
     }
 }
Esempio n. 22
0
        private void CmdPreviewFromStart_Executed(object sender, ExecutedEventArgs e)
        {
            if (visualizer.Display == VisualizerDisplay.Previewer)
            {
                return;
            }

            visualizer.Display = VisualizerDisplay.Previewer;

            var project = visualizer.Editor.Project;

            if (project.Project.HasMusic)
            {
                _liveControl.Load(project.Project.MusicFileName, out var errorMessageTemplate);

                if (errorMessageTemplate != null)
                {
                    var errorMessage = string.Format(errorMessageTemplate, project.Project.MusicFileName);
                    MessageBox.Show(this, errorMessage, AssemblyHelper.GetTitle(), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }

            visualizer.Previewer.Score = visualizer.Editor.CurrentScore;
            visualizer.Previewer.Prepare();
            visualizer.Previewer.RenderMode = DirectorSettingsManager.CurrentSettings.PreviewRenderMode;
            visualizer.Previewer.SimulateEditor(visualizer.Editor);

            _liveControl.Tick += LiveControl_Tick;

            _liveControl.Start();

            UpdateUIIndications();
        }
 /// <summary>
 /// Called when the Bootstrapper is initialized.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="Telerik.Sitefinity.Data.ExecutedEventArgs" /> instance containing the event data.</param>
 private static void OnBootstrapperInitialized(object sender, ExecutedEventArgs e)
 {
     if (e.CommandName == "RegisterRoutes")
     {
         SuperFormsInstaller.RegisterModule();
     }
 }
Esempio n. 24
0
        private void CmdProjectSave_Executed(object sender, ExecutedEventArgs e)
        {
            var project = visualizer.Editor.Project;

            if (project == null)
            {
                throw new InvalidOperationException();
            }
            if (!project.IsModified)
            {
                return;
            }
            if (project.WasSaved())
            {
                var writer = new SldprojV4Writer();

                Debug.Assert(project.SaveFilePath != null, "project.SaveFilePath != null");

                writer.WriteProject(project.Project, project.SaveFilePath);

                project.MarkAsClean();

                UpdateUIIndications();
            }
            else
            {
                CmdProjectSaveAs.Command.Execute(e.Parameter);
            }
        }
        private void Bootstrapper_Initialized(object sender, ExecutedEventArgs e)
        {
            if (e.CommandName == "Bootstrapped" && SystemManager.GetModule(CognitiveServicesModule.ModuleName) != null)
            {
                var configManager = ConfigManager.GetManager();
                configManager.Provider.Executed += this.ConfigEventHandler;

                if (defaultApiRoute == null)
                {
                    defaultApiRoute = RouteTable.Routes.MapHttpRoute(
                        name: "DefaultApi",
                        routeTemplate: "webapi/{controller}/{action}/{id}",
                        defaults: new { id = RouteParameter.Optional });
                }

                if (!this.IsCustomLibrariesProviderRegistered())
                {
                    this.RegisterCustomLibrariesProvider();
                    SystemManager.RestartApplication("Restart to enable custom libraries provider", SystemRestartFlags.Default, true);
                }

                if (this.ModuleHasRequiredSettings())
                {
                    var imageHandler = ObjectFactory.Container.Resolve <ImageHandler>();
                    imageHandler.Initialzie();
                }
            }
        }
 public void SalesInvoice_cmdProcess_Executed(SalesInvoice entity, ExecutedEventArgs e)
 {
     if (!entity.BillingCustomer.AllowedPaymentTypes.Any(type => type.IsRealPaymentType))
     {
         entity.Message(e);
     }
 }
Esempio n. 27
0
 private void LastPage(object sender, ExecutedEventArgs e)
 {
     Frame.ShowLoading();
     ViewModel.CurrentPage = ViewModel.MaxPage;
     ViewModel.UpdateSource();
     Frame.HideLoading();
 }
Esempio n. 28
0
 private static void Bootstrapper_Initialized(object sender, ExecutedEventArgs e)
 {
     if (e.CommandName == "RegisterRoutes")
     {
         RegisterRoutes(RouteTable.Routes);
     }
 }
        private void MC_LoadSimulationInput_Executed(object sender, ExecutedEventArgs e)
        {
            using (var stream = StreamFinder.GetLocalFilestreamFromOpenFileDialog("txt"))
            {
                if (stream != null)
                {
                    var simulationInput = FileIO.ReadFromJsonStream <SimulationInput>(stream);

                    var validationResult = SimulationInputValidation.ValidateInput(simulationInput);
                    if (validationResult.IsValid)
                    {
                        _simulationInputVM.SimulationInput = simulationInput;
                        logger.Info(() => "Simulation input loaded.\r");
                    }
                    else
                    {
                        logger.Info(() => "Simulation input not loaded - JSON format not valid.\r");
                    }
                }
                else
                {
                    logger.Info(() => "JSON File not loaded.\r");
                }
            }
        }
 /// <summary>
 /// Called when the Bootstrapper is initialized.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="Telerik.Sitefinity.Data.ExecutedEventArgs" /> instance containing the event data.</param>
 private static void OnBootstrapperInitialized(object sender, ExecutedEventArgs e)
 {
     if (e.CommandName == "RegisterRoutes")
     {
         TwoFactorAuthenticationInstaller.RegisterModule();
     }
 }
Esempio n. 31
0
        /// <summary>
        /// Replacement method for reloading latest which disables the DTM Tool.
        /// </summary>
        public static void OnReloadLatest(object sender, ExecutedEventArgs args)
        {
            // (Konrad) This will disable the DTM Tool when we are reloading latest.
            AppCommand.IsSynching = true;

            // (Konrad) Reloads Latest.
            AppCommand.EnqueueTask(app =>
            {
                try
                {
                    Log.AppendLog(LogMessageType.INFO, "Reloading Latest...");

                    var reloadOptions = new ReloadLatestOptions();
                    var doc           = app.ActiveUIDocument.Document;
                    doc.ReloadLatest(reloadOptions);
                    if (!doc.HasAllChangesFromCentral())
                    {
                        doc.ReloadLatest(reloadOptions);
                    }
                }
                catch (Exception e)
                {
                    Log.AppendLog(LogMessageType.EXCEPTION, e.Message);
                }
            });

            // (Konrad) Turns the DTM Tool back on when reload is done.
            AppCommand.EnqueueTask(app =>
            {
                AppCommand.IsSynching = false;
            });
        }
        private void CmdViewZoomIn_Executed(object sender, ExecutedEventArgs e)
        {
            var clientSize   = visualizer.Editor.ClientSize;
            var clientCenter = new Point(clientSize.Width / 2, clientSize.Height / 2);

            visualizer.Editor.ZoomIn(clientCenter);
        }
Esempio n. 33
0
 /// <summary>
 /// Handles the Initialized event of the Bootstrapper.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="Sitefinity.Data.ExecutedEventArgs"/> instance containing the event data.</param>
 protected virtual void Bootstrapper_Initialized(object sender, ExecutedEventArgs e)
 {
     if (e.CommandName == "Bootstrapped")
     {
         FrontendModuleInstaller.Bootstrapper_Initialized(this.initializers.Value);
     }
 }
Esempio n. 34
0
        private void Plot_DuplicateWindow_Executed(object sender, ExecutedEventArgs e)
        {
            var vm = this.Clone();

            vm.UpdatePlotSeries();
            Commands.Main_DuplicatePlotView.Execute(vm, vm);
        }
Esempio n. 35
0
 /// <summary>
 /// Writes tab-delimited
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void Plot_ExportDataToText_Executed(object sender, ExecutedEventArgs e)
 {
     if (_Labels != null && _Labels.Count > 0 && _PlotSeriesCollection != null && _PlotSeriesCollection.Count > 0)
     {
         using (var stream = StreamFinder.GetLocalFilestreamFromSaveFileDialog("txt"))
         {
             if (stream != null)
             {
                 using (StreamWriter sw = new StreamWriter(stream))
                 {
                     sw.Write("%");
                     _Labels.ForEach(label => sw.Write(label + " (X)" + "\t" + label + " (Y)" + "\t"));
                     sw.WriteLine();
                     for (int i = 0; i < _PlotSeriesCollection[0].Length; i++)
                     {
                         sw.WriteLine();
                         for (int j = 0; j < _PlotSeriesCollection.Count; j++)
                         {
                             sw.Write(_PlotSeriesCollection[j][i].X + "\t" + _PlotSeriesCollection[j][i].Y + "\t");
                         }
                     }
                 }
             }
         }
     }
 }
 /// <summary>
 /// Called when the Bootstrapper is initialized.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="Telerik.Sitefinity.Data.ExecutedEventArgs" /> instance containing the event data.</param>
 private static void OnBootstrapperInitialized(object sender, ExecutedEventArgs e)
 {
     if (e.CommandName == "RegisterRoutes")
     {
         // We have to register the module at a very early stage when sitefinity is initializing
         ImageOptimizationInstaller.RegisterModule();
     }
 }
Esempio n. 37
0
 private static void Bootstrapper_Initialized(object sender, ExecutedEventArgs e)
 {
     if (e.CommandName == "Bootstrapped")
     {
         Initializer.UnregisterTemplatableControl();
         Initializer.AddFieldsToToolbox();
     }
 }
 private void Bootstrapper_Initialized(object sender, ExecutedEventArgs e)
 {
     if ((Bootstrapper.IsDataInitialized) && (e.CommandName == "Bootstrapped"))
     {
         SystemManager.RunWithElevatedPrivilegeDelegate worker = new SystemManager.RunWithElevatedPrivilegeDelegate(this.CreateSample);
         SystemManager.RunWithElevatedPrivilege(worker);
     }
 }
Esempio n. 39
0
 private static void Bootstrapper_Initialized(object sender, ExecutedEventArgs e)
 {
     if (e.CommandName == "Bootstrapped")
     {
         Initializer.UnregisterTemplatableControl();
         Initializer.CreateFormsGoogleRecaptchaFieldConfig();
     }
 }
Esempio n. 40
0
        protected virtual void DataEngine_SavedItem(object sender, ExecutedEventArgs<SaveItemCommand> e)
        {
            var item = e.Command.Item;

            if (item.IsBucketItem())
            {
                item.RegisterMapping();
            }
        }
        private static void Bootstrapper_Initialized(object sender, ExecutedEventArgs e)
        {
            if (e.CommandName != "RegisterRoutes" || !Bootstrapper.IsDataInitialized)
            {
                return;
            }

            IntallWidget();
        }
Esempio n. 42
0
        private static void Bootstrapper_Initialized(object sender, ExecutedEventArgs e)
        {
            if (e.CommandName == "Bootstrapped")
            {
                VirtualPathManager.AddVirtualFileResolver<FormsVirtualRazorResolver>(FormsVirtualRazorResolver.Path + "*", "MvcFormsResolver");

                Initializer.UnregisterTemplatableControl();
                Initializer.AddFieldsToToolbox();
            }
        }
Esempio n. 43
0
        private static void Bootstrapper_Initialized(object sender, ExecutedEventArgs e)
        {
            if (e.CommandName != "RegisterRoutes" || !Bootstrapper.IsDataInitialized)
            {
                return;
            }

            Res.RegisterResource<LogicalFormsResources>();
            InstallVirtualPaths();
            InstallFormWidgets();
        }
Esempio n. 44
0
        protected override void OnExecuted(ExecutedEventArgs e)
        {
            if (e.Arguments.Count < 1) {
                e.Result = new JavaScriptObject(1);
            }
            else {
                var b = e.Arguments.First().ToInteger();
                e.Result = new JavaScriptObject(b + 1);
            }

            e.IsHandled = true;
        }
 void Bootstrapper_Initialized(object sender, ExecutedEventArgs e)
 {
     if (e.CommandName == "RegisterRoutes")
     {
         SampleUtilities.RegisterModule<ProductsModule>("ProductsCatalog", "This is a module that provides product listings built on top of a native content-based module in Sitefinity. Content-based modules themselves are based on Generic Content and reuse much of the functionality available there. This is the most comprehensive example of a content-based module that features all built-in functionality of a native Sitefinity module.");
     }
     if ((Bootstrapper.IsDataInitialized) && (e.CommandName == "Bootstrapped"))
     {
         SystemManager.RunWithElevatedPrivilegeDelegate worker = new SystemManager.RunWithElevatedPrivilegeDelegate(CreateSampleWorker);
         SystemManager.RunWithElevatedPrivilege(worker);
     }
 }
        protected override void OnExecuted(ExecutedEventArgs e)
        {
            var title = e.Arguments.First().ToString();
            if (string.IsNullOrWhiteSpace(title)) {
                // Chromium does not allow to send nothing over the wire, so we send the termination symbol instead.
                title = "\0";
            }

            var browser = ScriptingContext.Current.Browser;
            browser.SendIpcMessage(ProcessType.Browser, new IpcMessage("change-window-title") {
                Payload = title.ToUtf8Stream()
            });

            e.IsHandled = true;
        }
Esempio n. 47
0
            public Worker(ScriptingCommand c, ExecutedEventArgs e)
            {
                // Keep this worker alive after leaving local scope using a strong reference.
                Workers.Register(this);

                CancellationTokenSource = new CancellationTokenSource();

                // Store the current context;
                EntryContext = ScriptingContext.Current;

                // Keep strong references to the passed arguments.
                Callback = e.Arguments.ElementAt(0).ToFunction();
                Value = e.Arguments.ElementAt(1).ToInteger();

                // Keep a references to the command, so we'll be able to detach the event handler later.
                Command = c;
                Command.ScriptingContextReleased += OnScriptingContextReleased;
            }
Esempio n. 48
0
        /// <summary>
        /// Handles the Initialized event of the Bootstrapper.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="Sitefinity.Data.ExecutedEventArgs"/> instance containing the event data.</param>
        protected virtual void Bootstrapper_Initialized(object sender, ExecutedEventArgs e)
        {
            if (e.CommandName == "Bootstrapped")
            {
                this.RegisterFileObservers();

                var controllerInitializer = new ControllerInitializer();
                controllerInitializer.Initialize();

                var layoutsInitializer = new LayoutInitializer();
                layoutsInitializer.Initialize();

                var gridSystemInitializer = new GridSystemInitializer();
                gridSystemInitializer.Initialize();

                var designerInitializer = new DesignerInitializer();
                designerInitializer.Initialize();

                this.RegisterScripts();
            }
        }
Esempio n. 49
0
        /// <summary>
        /// Handles the Initialized event of the Bootstrapper.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="Sitefinity.Data.ExecutedEventArgs"/> instance containing the event data.</param>
        protected virtual void Bootstrapper_Initialized(object sender, ExecutedEventArgs e)
        {
            if (e.CommandName == "Bootstrapped")
            {
                var resourcesInitializer = new ResourcesInitializer();
                resourcesInitializer.Initialize();

                var fileMonitoringInitilizer = new FileMonitoringInitializer();
                fileMonitoringInitilizer.Initialize();

                var controllerContainerInitializer = new ControllerContainerInitializer();
                controllerContainerInitializer.Initialize();

                var layoutsInitializer = new LayoutInitializer();
                layoutsInitializer.Initialize();

                var gridSystemInitializer = new GridSystemInitializer();
                gridSystemInitializer.Initialize();

                var designerInitializer = new DesignerInitializer();
                designerInitializer.Initialize();
            }
        }
Esempio n. 50
0
        /// <summary>
        ///   Launches the save games viewer.
        /// </summary>
        /// <param name="p_objCommand">The command that is executing.</param>
        /// <param name="p_eeaArguments">
        ///   An <see cref="ExecutedEventArgs
        ///   
        ///   <MainForm>
        ///     "/> containing the
        ///     main mod management form.
        /// </param>
        public override void LaunchSaveGamesViewer(object p_objCommand, ExecutedEventArgs<MainForm> p_eeaArguments)
        {
            var lstActive = new List<string>();
              //the original implementation populated the inactive list with all plugins
              // we only populate it with inactive plugins - hopefully that's OK
              var lstInactive = new List<string>();

              foreach (var strPlugin in PluginManager.OrderedPluginList)
              {
            if (PluginManager.IsPluginActive(strPlugin))
            {
              lstActive.Add(Path.GetFileName(strPlugin));
            }
            else
            {
              lstInactive.Add(Path.GetFileName(strPlugin));
            }
              }
              (new SaveForm(lstActive.ToArray(), lstInactive.ToArray())).Show();
        }
Esempio n. 51
0
 /// <summary>
 ///   Toggles archive invalidation.
 /// </summary>
 /// <param name="p_objCommand">The command that is executing.</param>
 /// <param name="p_eeaArguments">
 ///   An <see cref="ExecutedEventArgs
 ///   
 ///   <MainForm>
 ///     "/> containing the
 ///     main mod management form.
 /// </param>
 public override void ToggleArchiveInvalidation(object p_objCommand, ExecutedEventArgs<MainForm> p_eeaArguments)
 {
     if (FalloutNewVegas.Tools.ArchiveInvalidation.Update())
       {
     ((CheckedCommand<MainForm>) p_objCommand).IsChecked =
       FalloutNewVegas.Tools.ArchiveInvalidation.IsActive();
       }
 }
Esempio n. 52
0
 private static void OnExecutedExportToExcelCommand(object sender, ExecutedEventArgs e)
 {
     ExportToExcel(sender as MyGrid);
 }
Esempio n. 53
0
        /// <summary>
        /// Handles the Initialized event of the Bootstrapper.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="Sitefinity.Data.ExecutedEventArgs"/> instance containing the event data.</param>
        protected virtual void Bootstrapper_Initialized(object sender, ExecutedEventArgs e)
        {
            if (e.CommandName == "Bootstrapped")
            {
                var resourcesInitializer = new ResourcesInitializer();
                resourcesInitializer.Initialize();

                var fileMonitoringInitilizer = new FileMonitoringInitializer();
                fileMonitoringInitilizer.Initialize();

                var controllerContainerInitializer = new ControllerContainerInitializer();
                controllerContainerInitializer.Initialize(this.controllerAssemblies);
                this.controllerAssemblies = null; // We won't be needing those anymore. Set them free.

                var layoutsInitializer = new LayoutInitializer();
                layoutsInitializer.Initialize();

                var designerInitializer = new DesignerInitializer();
                designerInitializer.Initialize();

                ObjectFactory.Container.RegisterType<ICommentNotificationsStrategy, Telerik.Sitefinity.Frontend.Modules.Comments.ReviewNotificationStrategy>(new ContainerControlledLifetimeManager());
            }
        }
 private void DataEngine_AddedVersion(object sender, ExecutedEventArgs<AddVersionCommand> e)
 {
     ExitDisabledState("Added Version of item '{0}' ('{1}:{2}')", e.Command.Item.Name, e.Command.Item.Language.Name, e.Command.Item.Version.Number);
 }
 private void DataEngine_AddedFromTemplate(object sender, ExecutedEventArgs<AddFromTemplateCommand> e)
 {
     ExitDisabledState("Added From Template item '{0}'", e.Command.ItemName);
 }
 private void DataEngine_CopiedItem(object sender, ExecutedEventArgs<CopyItemCommand> e)
 {
     ExitDisabledState("Copied item '{0}'", e.Command.Source.Name);
 }
        private void DataEngine_SavedItem(object sender, ExecutedEventArgs<SaveItemCommand> e)
        {
            if (e.Command.Changes.HasFieldsChanged)
            {
                foreach (FieldChange change in e.Command.Changes.FieldChanges)
                {
                    Cache.RemoveItemField(e.Command.Item, change.FieldID);
                }
            }

            ExitDisabledState("Saved item '{0}'", e.Command.Item.Name);
        }
 private void DataEngine_RemoveVersion(object sender, ExecutedEventArgs<RemoveVersionCommand> e)
 {
     Cache.RemoveItem(e.Command.Item);
 }
 private void DataEngine_DeletedItem(object sender, ExecutedEventArgs<DeleteItemCommand> e)
 {
     Cache.RemoveTree(e.Command.Item);
     SkipItemCache.UnSkipItem(e.Command.Item);
 }
 private void DataEngine_CreatedItem(object sender, ExecutedEventArgs<CreateItemCommand> e)
 {
     ExitDisabledState("Created item '{0}'", e.Command.ItemName);
 }