Example #1
0
 void Awake()
 {
     _animator  = GetComponent <Animator>();
     _uiService = ServiceLocator.GetService <UIService>();
     _uiService.SetActiveInGameUI  += UpdateIsInGameState;
     _uiService.SetActiveStoreMenu += UpdateIsInStoreState;
 }
Example #2
0
        private void Awake()
        {
            LastTrainPos         = transform.position;
            _achievementsService = ServiceLocator.GetService <AchievementsService>();
            _audioService        = ServiceLocator.GetService <AudioService>();
            _levelService        = ServiceLocator.GetService <LevelService>();
            _adsService          = ServiceLocator.GetService <AdsService>();
            _skinService         = ServiceLocator.GetService <SkinService>();
            _gameDataService     = ServiceLocator.GetService <GameDataService>();
            _uiService           = ServiceLocator.GetService <UIService>();
            _poolService         = ServiceLocator.GetService <PoolService>();

            Trains          = new List <TrainController>();
            spriteRenderer  = GetComponent <SpriteRenderer>();
            TargetPointList = TargetRail.WayPoints;
            TargetPoint     = TargetPointList[0].localPosition;
            Trains.Add(this);

            InputManager.Swipe      += InputManagerOnSwipe;
            _adsService.TrainRevive += ReviveTrain;
            _uiService.GameRestart  += ResetTrain;

            _skinService.UpdateSkin(spriteRenderer);
            UpdateTrainPoints();
            LockControlls = _uiService.IsFirstTime;
            IsFirstTime   = _uiService.IsFirstTime;
        }
Example #3
0
        /// <summary>
        /// Closes the application configuration.
        /// </summary>
        /// <param name="node">
        /// The node to execute the command upon.
        /// </param>
        protected override void ExecuteCore(ConfigurationNode node)
        {
            try
            {
                UIService.BeginUpdate();

                if (UIService.IsDirty(node.Hierarchy))
                {
                    DialogResult result = UIService.ShowMessage(Resources.SaveApplicationRequest, Resources.SaveApplicationCaption, MessageBoxButtons.YesNo);
                    if (DialogResult.Yes == result)
                    {
                        if (!TryAndSaveApplication(node))
                        {
                            return;
                        }
                    }
                }
                if (ErrorLogService.ConfigurationErrorCount > 0)
                {
                    UIService.DisplayErrorLog(ErrorLogService);
                    DialogResult result = UIService.ShowMessage(Resources.SaveApplicationErrorRequestMessage, Resources.SaveApplicationCaption, MessageBoxButtons.YesNo);
                    if (result == DialogResult.No)
                    {
                        return;
                    }
                }
                ConfigurationUIHierarchyService.RemoveHierarchy(node.Hierarchy.Id);
            }
            finally
            {
                UIService.EndUpdate();
            }
        }
Example #4
0
 private void Start()
 {
     if (UIService == null)
     {
         UIService = LSInjector.LSInjector.Instance.GetService <UIService>();
     }
 }
Example #5
0
        protected override void InnerExecute(object parameter)
        {
            OpenFileDialog openEnvironmentConfigurationDeltaDialog = new OpenFileDialog
            {
                Filter = DesignResources.DeltaDialogFilter,
                Title  = DesignResources.OpenDeltaDialogTitle
            };

            var openFileResult = UIService.ShowFileDialog(openEnvironmentConfigurationDeltaDialog);

            if (openFileResult.DialogResult != true)
            {
                return;
            }

            try
            {
                var configuration = ConfigurationManager.OpenMappedExeConfiguration(new ExeConfigurationFileMap {
                    ExeConfigFilename = openFileResult.FileName
                }, ConfigurationUserLevel.None);
                EnvironmentalOverridesSection mergeSection = (EnvironmentalOverridesSection)configuration.GetSection(EnvironmentalOverridesSection.EnvironmentallyOverriddenProperties);

                sourceModel.LoadEnvironment(mergeSection, openFileResult.FileName);
            }
            catch (Exception ex)
            {
                ConfigurationLogWriter.LogException(ex);
                UIService.ShowMessageWpf(string.Format(CultureInfo.CurrentCulture, Resources.ErrorLoadingDeltaFile, ex.Message),
                                         Resources.ErrorTitle,
                                         MessageBoxButton.OK);
            }
        }
Example #6
0
        protected override IEnumerable <IGridColumn <CustomView> > InitGridHeader()
        {
            var header       = new List <GridColumn <CustomView> >();
            var topheader    = this.MakeGridHeaderParent("父表头");
            var secondheader = this.MakeGridHeaderParent("父表头2");

            secondheader.SetChildren(
                this.MakeGridHeader(x => x.test3, 120),
                this.MakeGridHeader(x => x.test4, 120)
                );

            topheader.SetChildren(
                this.MakeGridHeader(x => x.test1, 120),
                secondheader,
                this.MakeGridHeader(x => x.test2, 120)
                );
            header.Add(topheader);
            header.Add(this.MakeGridHeader(x => "弹出框").SetTitle("弹出框").SetFormat((a, b) => {
                return(UIService.MakeButton(ButtonTypesEnum.Button, $"/_admin/actionlog/details/{a.ID}", "弹出框", 500, null, title: "日志", rtype: RedirectTypesEnum.Layer, buttonClass: "layui-btn-warm"));
            }));
            header.Add(this.MakeGridHeader(x => "新Tab").SetTitle("新Tab").SetFormat((a, b) => {
                return(UIService.MakeButton(ButtonTypesEnum.Button, $"/_admin/actionlog/details/{a.ID}", "弹出框", 500, null, title: "日志", rtype: RedirectTypesEnum.NewTab));
            }));
            header.Add(this.MakeGridHeader(x => "新Window").SetTitle("新Window").SetFormat((a, b) => {
                return(UIService.MakeButton(ButtonTypesEnum.Button, $"/_admin/actionlog/details/{a.ID}", "弹出框", 500, null, title: "日志", rtype: RedirectTypesEnum.NewWindow));
            }));
            header.Add(this.MakeGridHeader(x => "Self").SetTitle("Self").SetFormat((a, b) => {
                return(UIService.MakeButton(ButtonTypesEnum.Button, $"/_admin/actionlog/details/{a.ID}", "弹出框", 500, null, title: "日志", currentdivid: this.ViewDivId, rtype: RedirectTypesEnum.Self));
            }));

            header.Add(this.MakeGridHeaderAction(width: 320));

            return(header);
        }
        private void командаТехДиректору_ItemClick(System.Object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (!SaveCard())
            {
                UIService.ShowError("Сохранение не удалось. Выполните сохранение вручную");
                return;
            }

            var techDirectorRow = Document.GetSection(new System.Guid("F47D0D6B-07FE-4198-8F79-348AC55086E5"));     //Секция утверждено - соответствует тех.диру

            if (techDirectorRow.Count == 0)
            {
                UIService.ShowMessage("Не заполнено поле технического директора", "Проверка исполнителей задания на согласование");
                return;
            }
            int performingType = 0;

            if (techDirectorRow.Count > 1)
            {
                performingType = 1;
            }
            foreach (BaseCardSectionRow row in techDirectorRow)
            {
                sendApproval("техническим директором", Context.GetObject <StaffEmployee>(new System.Guid(row["Confirm"].ToString())), performingType);
            }
            changeState("TechDetailsApproval");
        }
Example #8
0
        protected override void OnStartup(StartupEventArgs e)
        {
#if !DEBUG
            this.DispatcherUnhandledException          += App_DispatcherUnhandledException;
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
#endif
            Logger.Default.Trace("程序启动。");

            base.OnStartup(e);

            LocalizationManager.Manager = new TelerikLocalizationManager();

            //判断是否设置过数据服务IP地址。
            //if (!File.Exists("cctvexe.dat"))
            //{
            //    AppDomain domain = AppDomain.CreateDomain("SettingDomain");
            //    domain.ExecuteAssembly("ConfSetting.exe");
            //    AppDomain.Unload(domain);
            //}

            UIService.PrepareApp();

            var    window  = new MainWindow();
            string appName = getAppName();
            if (appName != null)
            {
                window.Header = appName;
            }
            window.Loaded        += (_s, _e) => UIService.InitWindow(window);
            window.PreviewClosed += (_s, _e) => _e.Cancel = UIService.ExistsOpposerForExit();
            window.Closed        += (_s, _e) => UIService.OnClosed();
            window.Show();
        }
        private async Task ResetAsync()
        {
            if (HIOStaticValues.CheckSyncingData())
            {
                return;
            }
            HIOStaticValues.tmain.AccountManager.SourceItems.Clear();
            await UIService.Execute(async() =>
            {
                if (HIOStaticValues.CheckSyncingData())
                {
                    return;
                }
                if (HIOStaticValues.CONNECTIONBHIO == true)
                {
                    Commands ic = new Commands();
                    if (!ic.EraseAll())
                    {
                        HIOStaticValues.popUp("Something went wrong!");
                    }
                }
                else
                {
                    HIOStaticValues.popUp("HIO is not connect!");
                }
            });

            //Application.Current.Dispatcher.Invoke(new Action(() =>
            //{
            //    AddNewDevice();
            //}));
        }
Example #10
0
        private string subField(string fieldname, CodeGenListView entity)
        {
            string rv = $"<input type=\"hidden\" name=\"{fieldname}.RelatedField\" value=\"{entity.LinkedType}\" />";

            rv += $"<input type=\"hidden\" name=\"{fieldname}.SubIdField\" value=\"{entity.SubIdField}\" />";
            if (string.IsNullOrEmpty(entity.LinkedType) == false)
            {
                var linktype = Type.GetType(entity.LinkedType);
                if (linktype != typeof(FileAttachment))
                {
                    var subpros            = Type.GetType(entity.LinkedType).GetProperties(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.DeclaredOnly).Where(x => x.GetMemberType() == typeof(string)).OrderBy(x => x.Name).ToList().ToListItems(x => x.Name, x => x.Name);
                    var subproswithname    = subpros.Where(x => x.Text.ToLower().Contains("name")).ToList();
                    var subproswithoutname = subpros.Where(x => x.Text.ToLower().Contains("name") == false).ToList();
                    subpros = new List <ComboSelectListItem>();
                    subpros.AddRange(subproswithname);
                    subpros.AddRange(subproswithoutname);
                    rv += UIService.MakeCombo(fieldname + ".SubField", subpros);
                }
                else
                {
                    rv += $"<input type=\"hidden\" name=\"{fieldname}.SubField\" value=\"`file\" />";
                }
            }
            return(rv);
        }
        public async void OnRevertCommand(object parameter)
        {
            if (_gitRepository.TryGetTarget(out IGitRepository gitRepository) == false)
            {
                return;
            }
            List <string> file_list = new List <string>();
            string        msg       = "Revert below:\n\n";

            foreach (var item in SelectedModifiedFilePathList)
            {
                file_list.Add(item);
                msg += string.Format("{0}\n", item);
            }
            if (file_list.Count == 0)
            {
                return;
            }
            if (UIService.ConfirmMsg(msg, "Revert") == System.Windows.MessageBoxResult.Cancel)
            {
                return;
            }
            foreach (var item in file_list)
            {
                gitRepository.AddLog("Revert: " + item);
                gitRepository.GetGitWrapper().P4Revert(item);
            }
            await gitRepository.Refresh();
        }
Example #12
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="node"></param>
        protected override void ExecuteCore(ConfigurationNode node)
        {
            ManageableConfigurationSourceElementNode sourceNode = node as ManageableConfigurationSourceElementNode;

            if (sourceNode != null)
            {
                // check current configuration == selected configuration?

                // check for dirty and ask for saving
                if (UIService.IsDirty(node.Hierarchy))
                {
                    DialogResult result
                        = UIService.ShowMessage(Resources.SaveApplicationBeforeExportingAdmRequest,
                                                Resources.SaveApplicationCaption,
                                                MessageBoxButtons.YesNo);
                    if (DialogResult.Yes == result)
                    {
                        if (!TryAndSaveApplication(node))
                        {
                            return;
                        }
                    }
                }

                TryAndExportAdmTemplate(sourceNode);
            }
        }
Example #13
0
        static void Main(string[] args)
        {
            var ui = new UIService();

            var path = string.Empty;

            if (!ui.UserEnteredPath(out path))
            {
                ui.ShowBye();
                return;
            }

            var files = new PptFilesIterator(path);

            if (!ui.UserWantRenameFiles(files))
            {
                ui.ShowBye();
                return;
            }

            var pptService = new PptFileService();
            var count      = files.Count();
            int index      = 0;

            foreach (var file in files)
            {
                ui.ShowFileInfo(file.FullName, ++index, count);
                var newFile = pptService.RenameFile(file);
                ui.ShowNewFileInfo(newFile);
            }

            ui.ShowDone();
        }
Example #14
0
        void insertData()
        {
            Commands ic = new Commands();

            UIService.Execute(async() =>
            {
                if (HIOStaticValues.TPinStatus())
                {
                    int res = ic.Insert(EditingObject.Url, EditingObject.Username, EditingObject.Name, EditingObject.Password);
                    try
                    {
                        HIOStaticValues.tmain?.AccountManager?.LoadData();
                        HIOStaticValues.tmain?.AccountManager?.OnPropertyChanged(nameof(TAccountManagerViewModel.IsAllChecked));
                    }
                    catch { /*TODO: remove try catch*/ }
                    if (res == 1)
                    {
                        System.Windows.Application.Current.Dispatcher.BeginInvoke(new Action(() =>
                        {
                            if (!IsClosed)
                            {
                                Close();
                            }
                        }));
                    }
                }
            }).Wait();
        }
Example #15
0
        /// <summary>
        /// <para>
        /// Executes the validation for the current node and all the child nodes.
        /// </para>
        /// </summary>
        /// <param name="node">
        /// <para>The <see cref="ConfigurationNode"/> to validate.</para>
        /// </param>
        protected override void ExecuteCore(ConfigurationNode node)
        {
            ValidationErrorCollection errors = new ValidationErrorCollection();

            Validate(node, errors);
            if (errors.Count > 0)
            {
                foreach (ValidationError error in errors)
                {
                    ConfigurationErrorLogService.LogError(error);
                }
            }
            if (ConfigurationErrorLogService.ValidationErrors.Count > 0)
            {
                if (ConfigurationErrorLogService.ValidationErrors.Count > 0)
                {
                    UIService.DisplayErrorLog(ConfigurationErrorLogService);
                }

                if (reportErrorsOnFailure)
                {
                    UIService.ShowMessage(SR.ValidationErrorsMessage, SR.ValidationCaption);
                }
                ConfigurationErrorLogService.ClearErrorLog();
                validationSucceeded = false;
            }
            else
            {
                validationSucceeded = true;
            }
        }
Example #16
0
        protected override void ExecuteCore(ConfigurationNode node)
        {
            TypeSelectorUI selector = new TypeSelectorUI(
                typeof(Exception),
                typeof(Exception),
                TypeSelectorIncludeFlags.BaseType |
                TypeSelectorIncludeFlags.AbstractTypes);
            DialogResult result = selector.ShowDialog();

            if (result == DialogResult.OK)
            {
                base.ExecuteCore(node);
                ExceptionTypeNode typeNode = (ExceptionTypeNode)ChildNode;
                typeNode.TypeName           = selector.SelectedType.AssemblyQualifiedName;
                typeNode.PostHandlingAction = PostHandlingAction.NotifyRethrow;
                try
                {
                    typeNode.Name = selector.SelectedType.Name;
                }
                catch (InvalidOperationException)
                {
                    typeNode.Remove();
                    UIService.ShowError(SR.DuplicateExceptionTypeErrorMessage(selector.SelectedType.Name));
                }
            }
        }
        DialogResult RunDialog(Form dialog)
        {
            if (dialog == null)
            {
                throw new ArgumentNullException("dialog");
            }

            if (!AutoScaleBaseSize.IsEmpty)
            {
                dialog.AutoScaleBaseSize = AutoScaleBaseSize;
            }

            if (UIService != null)
            {
                return(UIService.ShowDialog(dialog));
            }
            else if (_window != null)
            {
                return(dialog.ShowDialog(_window));
            }
            else
            {
                return(dialog.ShowDialog());
            }
        }
Example #18
0
        public static void Main()
        {
            var fileDialogService = new UIService();
            var vm = new MainWindowVM(fileDialogService);

            StartWindowsEngine(vm);
        }
Example #19
0
        public static void Initialize()
        {
            DbConnection connection = Effort.DbConnectionFactory.CreateTransient();

            dbContext = new NForumDbContext(connection);

            DataStore = new NForum.Database.EntityFramework.EntityFrameworkDataStore(
                new GenericRepository <NForum.Database.EntityFramework.Dbos.Category>(dbContext),
                new GenericRepository <NForum.Database.EntityFramework.Dbos.Forum>(dbContext),
                new GenericRepository <NForum.Database.EntityFramework.Dbos.Topic>(dbContext),
                new GenericRepository <NForum.Database.EntityFramework.Dbos.Reply>(dbContext),
                new GenericRepository <NForum.Database.EntityFramework.Dbos.ForumUser>(dbContext)
                );

            GenericRepository <NForum.Database.EntityFramework.Dbos.ForumUser> fuRepo = new GenericRepository <Database.EntityFramework.Dbos.ForumUser>(dbContext);

            NForum.Database.EntityFramework.Dbos.ForumUser fu = fuRepo.Create(new Database.EntityFramework.Dbos.ForumUser {
                Deleted      = false,
                EmailAddress = "*****@*****.**",
                ExternalId   = "todo",
                Fullname     = "mrfake",
                Username     = "******",
                UseFullname  = true
            });

            PermissionService = new PermissionService();
            LoggingService    = new LoggingService(new FakeLogger(), new FakeLogger());
            UserProvider      = new FakeUserProvider(fu);
            EventPublisher    = new FakeEventPublisher();

            CategoryService = new CategoryService(DataStore, PermissionService, LoggingService, UserProvider, EventPublisher);
            ForumService    = new ForumService(DataStore, PermissionService, LoggingService, UserProvider, EventPublisher);
            TopicService    = new TopicService(DataStore, PermissionService, LoggingService, UserProvider, EventPublisher);
            UIService       = new UIService(DataStore, PermissionService, LoggingService, UserProvider, new FakeSettings());
        }
 protected override void ExecuteSystem(List<GameEntity> entities)
 {
     UIService.ShowWidget<AWidget>(GameConfigurations.AssetReferenceConfiguration.PauseOverlay, new BattleResultWidgetProperties("Paused"));
     //UIService.ShowWidget<AWidget>(GameConfigurations.AssetReferenceConfiguration.BattleResultWidget,
     //  new BattleResultWidgetProperties("Pause"));
     Time.timeScale = 0f;
 }
Example #21
0
        private void btnRemoveSite_Click(object sender, EventArgs e)
        {
            TreeNode selectedNode = treeView1.SelectedNode;

            if (selectedNode == null)
            {
                return;
            }

            if (!(selectedNode.Tag is global::Microsoft.Web.Administration.Site node))
            {
                return;
            }

            var result = UIService.ShowMessage(
                "Are you sure that you want to remove the selected site?",
                "Confirm Remove",
                MessageBoxButtons.YesNoCancel,
                MessageBoxIcon.Question,
                MessageBoxDefaultButton.Button1);

            if (result != DialogResult.Yes)
            {
                return;
            }

            node.Parent.Remove(node);
            node.Server.CommitChanges();
            selectedNode.Remove();
        }
        public new static async Task ClassInitialize(TestContext testContext)
        {
            SyncronizedTest.ClassInitialize(testContext);

            // Wait till root frame is loaded
            Frame frame = null;

            while (frame == null)
            {
                await UIService.RunOnUI(() => {
                    frame = UIService.Frame;
                });

                await Task.Delay(100);
            }

            // Direct to MainPage
            await UIService.RunOnUI(() =>
                                    UIService.Frame.Navigate(typeof(MainPage)));

            // Wait till MainPAge is loaded
            bool isLoaded = false;

            while (!isLoaded)
            {
                await UIService.RunOnUI(() => {
                    isLoaded = ((Page)UIService.Frame.Content).IsLoaded;
                });

                await Task.Delay(100);
            }
        }
Example #23
0
        private string subField(string fieldname, CodeGenListView entity)
        {
            string rv = $"<input type='hidden' name='{fieldname}.RelatedField' value='{entity.LinkedType}' />";

            rv += $"<input type='hidden' name='{fieldname}.SubIdField' value='{entity.SubIdField}' />";
            if (string.IsNullOrEmpty(entity.LinkedType) == false)
            {
                var linktype = Type.GetType(entity.LinkedType);
                if (linktype != typeof(FileAttachment))
                {
                    var subpros            = Type.GetType(entity.LinkedType).GetProperties(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance).Where(x => x.GetMemberType() == typeof(string) && x.Name != "BatchError").OrderBy(x => x.Name).ToList().ToListItems(x => x.Name, x => x.Name);
                    var subproswithname    = subpros.Where(x => x.Text.ToLower().Contains("name")).ToList();
                    var subproswithoutname = subpros.Where(x => x.Text.ToLower().Contains("name") == false).ToList();
                    subpros = new List <ComboSelectListItem>();
                    subpros.AddRange(subproswithname);
                    subpros.AddRange(subproswithoutname);
                    if (subpros.Count == 0)
                    {
                        subpros.Add(new ComboSelectListItem {
                            Text = "Id", Value = "Id"
                        });
                    }
                    rv += UIService.MakeCombo(fieldname + ".SubField", subpros);
                }
                else
                {
                    rv += $"<input type='hidden' name='{fieldname}.SubField' value='`file' />";
                }
            }
            return(rv);
        }
Example #24
0
 private void ListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (MovieView.IsSelected)
     {
         TryNavigate(typeof(View), "MovieView");
     }
     if (StudioView.IsSelected)
     {
         TryNavigate(typeof(Domain.Studio.View), "StudioView");
     }
     if (Load.IsSelected)
     {
         AppFrame.Navigate(typeof(OpeningView));
         UIService.PresentMessageSingleActionCancel("Are you sure you want to LOAD model data?", "LOAD", new RelayCommand(PersistencyManager.Load));
     }
     if (Save.IsSelected)
     {
         AppFrame.Navigate(typeof(OpeningView));
         UIService.PresentMessageSingleActionCancel("Are you sure you want to SAVE model data?", "SAVE", new RelayCommand(PersistencyManager.Save));
     }
     if (Quit.IsSelected)
     {
         AppFrame.Navigate(typeof(OpeningView));
         UIService.PresentMessageSingleActionCancel("Are you sure you want to QUIT?", "QUIT", new RelayCommand(Application.Current.Exit));
     }
 }
        public void OnModifiedDiffCommand(object parameter)
        {
            if (_gitRepository.TryGetTarget(out IGitRepository gitRepository) == false)
            {
                return;
            }
            List <string> error_msg_list = new List <string>();

            foreach (var filepath in SelectedModifiedFilePathList)
            {
                var file_status = GetModifiedStatus(filepath);
                if (file_status == null)
                {
                    continue;
                }
                if (file_status.Status == "Untracked")
                {
                    string filename = System.IO.Path.Combine(gitRepository.GetGitWrapper().GetPath(), filepath);
                    GlobalSetting.GetInstance().ViewFile(filename);
                    continue;
                }
                gitRepository.AddLog(String.Format("Diff {0}", filepath));
                gitRepository.GetGitWrapper().DiffTool(filepath);
            }

            foreach (string error_msg in error_msg_list)
            {
                UIService.ShowMessage(error_msg);
            }
        }
Example #26
0
        public async void Delete()
        {
            Commands cmd = new Backend.Commands();

            if (TMessageBox.Show("Are you sure you want to delete this account?", "Confirm", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
            {
                while (true)
                {
                    var res = cmd.AmISync();
                    if (res == SyncronizingStateEnum.Synced)
                    {
                        break;
                    }
                    else
                    {
                        HIOStaticValues.SyncOpration();
                    }
                }

                await UIService.Execute(async() =>
                {
                    Commands ic = new Commands();
                    ic.Delete(UserID);
                    await Parent.LoadData();
                });

                Parent?.OnPropertyChanged(nameof(TAccountManagerViewModel.IsAllChecked));
            }
        }
        public async void OnAmendClickedCommand(object parameter)
        {
            if (_gitRepository.TryGetTarget(out IGitRepository gitRepository) == false)
            {
                return;
            }
            if (IsAmendCommit == false)
            {
                return;
            }
            string        cmd   = GitCommandCreator.GetLastCommitMessage();
            List <string> lines = await gitRepository.CreateGitRunner().RunAsync(cmd);

            if (lines.Count < 2)
            {
                UIService.ShowMessage("Invalid HEAD commit message");
                return;
            }
            // remove empty last line
            if (string.IsNullOrEmpty(lines[lines.Count - 1]))
            {
                lines.RemoveAt(lines.Count - 1);
            }
            string lastCommitMessage = string.Join(Environment.NewLine, lines);
            string showMessage       = $"{lastCommitMessage}{Environment.NewLine}{Environment.NewLine}Use above HEAD message as amend commit message?";

            if (UIService.ShowMessageWithYesNo(showMessage) == System.Windows.MessageBoxResult.Yes)
            {
                CommitMessage = lastCommitMessage;
                NotifyPropertyChanged("CommitMessage");
            }
        }
Example #28
0
        private object GenerateCheckBox(FrameworkMenu_ListView item)
        {
            string rv = "";

            if (item.FolderOnly == false)
            {
                if (item.IsInside == true)
                {
                    var others = item.Children?.ToList();
                    rv += UIService.MakeCheckBox(item.Allowed, "主页面", "menu_" + item.ID, "1");
                    if (others != null)
                    {
                        foreach (var c in others)
                        {
                            rv += UIService.MakeCheckBox(c.Allowed, c.ActionName, "menu_" + c.ID, "1");
                        }
                    }
                }
                else
                {
                    rv += UIService.MakeCheckBox(item.Allowed, "主页面", "menu_" + item.ID, "1");
                }
            }
            return(rv);
        }
Example #29
0
        public static List <PluginData> GetPlugins()
        {
            if (_pluginDatas != null)
            {
                return(_pluginDatas);
            }
            string pluginRootDirectoryPath = GetPluginRootDirectoryPath();

            if (Directory.Exists(pluginRootDirectoryPath) == false)
            {
                Directory.CreateDirectory(pluginRootDirectoryPath);
            }
            string[] directory_names = Directory.GetDirectories(pluginRootDirectoryPath);
            _pluginDatas = new List <PluginData>();
            foreach (string directory_name in directory_names)
            {
                try
                {
                    string xml_filename = Path.Combine(directory_name, "Plugin.xml");
                    _pluginDatas.Add(PluginData.CreateFromXmlFile(xml_filename));
                }
                catch (System.Exception exception)
                {
                    UIService.ShowMessage(string.Format("Cannot load plugin,{0},{1}", directory_name, exception.Message));
                }
            }
            return(_pluginDatas);
        }
Example #30
0
        private object GenerateCheckBox(FrameworkMenu_ListView item)
        {
            StringBuilder rv = new StringBuilder();

            if (item.FolderOnly == false)
            {
                rv.Append($"<input do-not-use-selectall hidden lay-skin='primary' type='checkbox' title='{Localizer["Sys.All"]}'>");
                if (item.IsInside == true)
                {
                    var others = item.Children?.ToList();
                    rv.Append(UIService.MakeCheckBox(item.Allowed, Localizer["Sys.MainPage"], "menu_" + item.ID, "1"));
                    if (others != null)
                    {
                        foreach (var c in others)
                        {
                            string actionname = "";
                            if (c.ActionName != null)
                            {
                                actionname = Localizer[c.ActionName];
                            }
                            rv.Append(UIService.MakeCheckBox(c.Allowed, actionname, "menu_" + c.ID, "1"));
                        }
                    }
                }
                else
                {
                    rv.Append(UIService.MakeCheckBox(item.Allowed, Localizer["Sys.MainPage"], "menu_" + item.ID, "1"));
                }
            }

            return(rv.ToString());
        }
Example #31
0
        public void InitEx(ConfigurationService configService, UIService uiService)
        {
            if (configService == null) throw new ArgumentNullException("configService");
            if (uiService == null) throw new ArgumentNullException("uiService");

            m_configService = configService;
            m_uiService = uiService;
        }
Example #32
0
        /// <summary>
        /// Anywhere in the iQuote page that contains a tag in the format of:
        ///     %TAG_TYPE%
        /// Gets replaced with the corresponding Info() value from configuration,
        /// which is the partner info configuration section.
        /// </summary>
        public static string ProcessTags(string url, string input)
        {
            UIService uiService = new UIService();

            QuoteHeader qHeader = (QuoteHeader)HttpContext.Current.Session["Header"];

            Match m;
            string tag;
            string replacementText = string.Empty;

            if (input.Contains("%"))
            {
                while (tagRegex.IsMatch(input))
                {

                    m = tagRegex.Matches(input)[0];
                    tag = m.Groups[2].ToString();

                    switch (tag)
                    {
                        case "PolicyNumber":
                            replacementText = "POLICY??";
                            break;
                        case "QuoteNumber":
                            replacementText = qHeader.QuoteNumber;
                            break;
                        case "ReferenceNumber":
                            if (!String.IsNullOrEmpty(qHeader.SessionId.ToString()))
                                replacementText = qHeader.SessionId.ToString();
                            else
                                replacementText = String.Empty;
                            break;
                        case "GoogleAnalyticsTracker":
                            replacementText = uiService.GetPartnerSetting("GoogleAnalyticsTracker");
                            break;
                        case "EffectiveDatePlus60":

                                DateTime EffctiveDate = Convert.ToDateTime(qHeader.PolicyEffectiveDate);
                                EffctiveDate = EffctiveDate.AddDays(60);
                                replacementText = EffctiveDate.ToShortDateString();

                            break;
                        case "CurrentDatePlus60":
                            DateTime currentDate = DateTime.Now;
                            currentDate = currentDate.AddDays(61);
                            replacementText = currentDate.ToShortDateString();
                            break;
                        case "ShortProductName":
                            if (qHeader.FormCode == 3) replacementText = "Home";
                            else if (qHeader.FormCode == 4) replacementText = "Renters";
                            else if (qHeader.FormCode == 6) replacementText = "Condo";
                            else throw new PresentationException(string.Format("Unknown FormCode {0} in ShortProductName substitution", qHeader.FormCode));
                            break;
                        case "WelcomeText":
                            if(qHeader.PartnerId.Equals(2319))
                            {
                                replacementText = uiService.GetWelcomeText();
                            }
                            else
                            {
                                replacementText = "";
                            }
                            break;
                        default:
                            replacementText = uiService.GetPartnerInfo(tag);
                            break;
                    }

                    try
                    {
                        input = tagRegex.Replace(input, replacementText, 1);
                    }
                    catch (ArgumentNullException ex)
                    {
                        throw new PresentationException("tag '" + tag + "' detected but replacement text was null... config files are messed up?" + ex.Message, ex.InnerException);
                    }
                }
            }

            return input;
        }
Example #33
0
 public UIServiceUpdater(UIService uIService)
 {
     this.uIService = uIService;
 }