/// <summary>
        /// Handles the ItemDataBound event of the dgFile control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="T:System.Web.UI.WebControls.DataGridItemEventArgs"/> instance containing the event data.</param>
        private void dgFile_ItemDataBound(object sender, DataGridItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem ||
                e.Item.ItemType == ListItemType.EditItem)
            {
                Image imgType = (Image)e.Item.FindControl("imgType");
                //PlaceHolder plhImgEdit = (PlaceHolder)e.Item.FindControl("plhImgEdit");
                LinkButton lnkName = (LinkButton)e.Item.FindControl("lnkName");
                //HyperLink imgACL = (HyperLink)e.Item.FindControl("imgACL");


                //HyperLink for Edit Text
                HyperLink hlImgEdit = new HyperLink();
                hlImgEdit.ImageUrl    = CurrentTheme.GetModuleImageSRC("btnEdit.gif");
                hlImgEdit.NavigateUrl = Path.ApplicationFullPath + "Desktopmodules/Filemanager/EditFile.aspx?ID=" +
                                        GetCurDir() + "\\" + DataBinder.Eval(e.Item.DataItem, "filename");
                //----

                int type = int.Parse(DataBinder.Eval(e.Item.DataItem, "type", "{0}"));
                if (type == 0)
                {
                    imgType.ImageUrl     = CurrentTheme.GetModuleImageSRC("dir.gif");
                    e.Item.Cells[2].Text = "";
                    e.Item.Cells[3].Text = "";
                }
                else
                {
                    string name = DataBinder.Eval(e.Item.DataItem, "filename", "{0}").Trim().ToLower();
                    lnkName.Enabled = IsDownloadable(name);
                    string ext = name.Substring(name.LastIndexOf(".") + 1);
                    imgType.ImageUrl = Path.WebPathCombine(Path.ApplicationRoot, "aspnet_client/Ext/" + imageAsign(ext));
                }
            }
        }
示例#2
0
 /// <summary>
 /// Gets the highlighting theme definition by name, or null if there is none to be found.
 /// </summary>
 /// <param name="highlightingName"></param>
 SyntaxDefinition IHighlightingThemeDefinitionReferenceResolver.GetThemeDefinition(string highlightingName)
 {
     lock (lockObj)
     {
         return(CurrentTheme?.GetThemeDefinition(highlightingName));
     }
 }
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            portalPages = new PagesDB().GetPagesFlat(portalSettings.PortalID);
            tabList.DataBind();

            // Set the ImageUrl for controls from current Theme
            upBtn.ImageUrl     = CurrentTheme.GetImage("Buttons_Up", "Up.gif").ImageUrl;
            downBtn.ImageUrl   = CurrentTheme.GetImage("Buttons_Down", "Down.gif").ImageUrl;
            DeleteBtn.ImageUrl = CurrentTheme.GetImage("Buttons_Delete", "Delete.gif").ImageUrl;
            EditBtn.ImageUrl   = CurrentTheme.GetImage("Buttons_Edit", "Edit.gif").ImageUrl;

            // If this is the first visit to the page, bind the tab data to the page listbox
            if (!Page.IsPostBack)
            {
                // 2/27/2003 Start - Ender Malkoc
                // After up or down button when the page is refreshed,
                // select the previously selected tab from the list.
                if (Request.Params["selectedtabID"] != null)
                {
                    try {
                        int tabIndex = Int32.Parse(Request.Params["selectedtabID"]);
                        SelectPage(tabIndex);
                    }
                    catch {
                    }
                }
                // 2/27/2003 End - Ender Malkoc
            }
        }
 /// <summary>
 /// Inits the images.
 /// </summary>
 private void InitImages()
 {
     imgroot               = Path.WebPathCombine(CurrentTheme.WebPath, "/img/");
     btnDelete.ImageUrl    = CurrentTheme.GetModuleImageSRC("delete.png");
     btnGoUp.ImageUrl      = CurrentTheme.GetModuleImageSRC("FolderUp.gif");
     btnNewFolder.ImageUrl = CurrentTheme.GetModuleImageSRC("newfolder.gif");
 }
        private void SetDatata(string modulePath)
        {
            string folderName = modulePath;
            int    start      = folderName.IndexOf("|");

            folderName = folderName.Substring(start + 1);
            int    fileNameStart = folderName.LastIndexOf("/");
            string fileName      = folderName.Substring(fileNameStart + 1);
            string completePath  = folderName + "/" + fileName;


            if (
                File.Exists(
                    HttpContext.Current.Server.MapPath(Path.ApplicationRoot + "/rb_documentation/" + completePath +
                                                       ".xml")))
            {
                AddModuleHelp.Visible = true;
                string javaScript = "HelpWindow=window.open('"
                                    + Path.ApplicationRoot + "/rb_documentation/Viewer.aspx?loc=" + folderName + "&src=" +
                                    fileName
                                    +
                                    "','HelpWindow','toolbar=no,location=no,directories=no,status=no,menubar=yes,scrollbars=yes,resizable=yes,width=640,height=480,left=15,top=15'); return false;";
                AddModuleHelp.Attributes.Add("onclick", javaScript);
                AddModuleHelp.Attributes.Add("style", "cursor: hand;");
                AddModuleHelp.NavigateUrl = string.Empty;
                AddModuleHelp.ImageUrl    = CurrentTheme.GetImage("Buttons_Help", "Help.gif").ImageUrl;
                AddModuleHelp.ToolTip     = moduleType.SelectedItem.Text.ToString() + " Help";
            }
            else
            {
                AddModuleHelp.Visible = false;
            }
        }
        /// <summary>
        /// The Page_Load server event handler on this user control is used
        /// to populate the current portals list from the database
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param>
        private void Page_Load(object sender, EventArgs e)
        {
            portals = new ArrayList();
            PortalsDB     portalsDb = new PortalsDB();
            SqlDataReader dr        = portalsDb.GetPortals();

            try
            {
                while (dr.Read())
                {
                    PortalItem p = new PortalItem();
                    p.Name = dr["PortalName"].ToString();
                    p.Path = dr["PortalPath"].ToString();
                    p.ID   = Convert.ToInt32(dr["PortalID"].ToString());
                    portals.Add(p);
                }
            }
            finally
            {
                dr.Close(); //by Manu, fixed bug 807858
            }

            // If this is the first visit to the page, bind the tab data to the page listbox
            if (Page.IsPostBack == false)
            {
                portalList.DataBind();
            }
            EditBtn.ImageUrl   = CurrentTheme.GetImage("Buttons_Edit", "Edit.gif").ImageUrl;
            DeleteBtn.ImageUrl = CurrentTheme.GetImage("Buttons_Delete", "Delete.gif").ImageUrl;
            DeleteBtn.Attributes.Add("onclick", "return confirmDelete();");
        }
示例#7
0
 public override void Apply()
 {
     try
     {
         CurrentTheme?.Remove();
         Application.Current.Resources.MergedDictionaries.Add(new ResourceDictionary()
         {
             Source = new Uri("pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml")
         });
         Application.Current.Resources.MergedDictionaries.Add(new ResourceDictionary()
         {
             Source = new Uri("pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml")
         });
         ResourceDictionary resourceDictionary = new ResourceDictionary()
         {
             Source = new Uri($"pack://application:,,,/MahApps.Metro;component/Styles/Themes/{DictionaryName}.xaml")
         };
         if (resourceDictionary == null)
         {
             throw new NullReferenceException();
         }
         Application.Current.Resources.MergedDictionaries.Add(resourceDictionary);
         App.Current.Resources["AccentColor"] = new BrushConverter().ConvertFromString(AccentColor);
         if (DictionaryName[0] == 'L')
         {
             App.Current.Resources["BackgroundColor"] = new BrushConverter().ConvertFromString("#FFFFFF");
         }
         else if (DictionaryName[0] == 'D')
         {
             App.Current.Resources["BackgroundColor"] = new BrushConverter().ConvertFromString("#252525");
         }
     }
     catch { App.Logger.Log($"Can't apply {Name} theme"); }
 }
示例#8
0
        public Boolean SetCurrentTheme(String name, Boolean applySetting)
        {
            try
            {
                // Find theme for name
                IMesTheme theme = Themes.FirstOrDefault(x => x.Name == name);
                if (theme == null)
                {
                    return(false);
                }
                CurrentTheme = theme;

                // Setup asnc info
                Mvx.IoCProvider.Resolve <IMvxMainThreadAsyncDispatcher>()
                .ExecuteOnMainThreadAsync(() =>
                {
                    // Setup app style
                    ResourceDictionary appTheme =
                        Application.Current.Resources.MergedDictionaries.Count > 0
                        ? Application.Current.Resources.MergedDictionaries[0] : null;

                    if (appTheme == null)
                    {
                        appTheme = new ResourceDictionary();
                        Application.Current.Resources.MergedDictionaries.Add(appTheme);
                    }

                    appTheme.BeginInit();

                    appTheme.MergedDictionaries.Clear();
                    foreach (Uri uri in theme.ApplicationResources)
                    {
                        ResourceDictionary newDict = new ResourceDictionary {
                            Source = uri
                        };
                        appTheme.MergedDictionaries.Add(newDict);
                    }
                    appTheme.EndInit();
                });

                _log?.LogInformation($"Theme set to {name}");

                // publish event
                _messenger.Publish(new MesThemeChangeMessage(this, CurrentTheme.Name));

                if (applySetting)
                {
                    Properties.Settings.Default.ThemeName = CurrentTheme.GetType().Name;
                    Properties.Settings.Default.Save();
                }

                return(true);
            }
            catch (Exception e)
            {
                _log?.LogInformation(e, "Log Theme Setting");
                return(false);
            }
        }
示例#9
0
文件: Utils.cs 项目: tckhanh/Vilas103
 static string GetFirstItemForBaseColorList()
 {
     if (CurrentTheme.Equals("MaterialCompact"))
     {
         return((CurrentThemesModel.GetThemeModel("MaterialCompact")).BaseColor);
     }
     return(CurrentThemeDefaultBaseColor);
 }
示例#10
0
 public void AddCurrentPhrase()
 {
     var phrase = CurrentTheme?.CurrentPhrase;
     if (!string.IsNullOrEmpty(phrase))
     {
         Result = Result + phrase + Environment.NewLine;
         CurrentTheme.Reset();
     }
 }
示例#11
0
 /// <summary>
 /// Updates <see cref="CurrentTheme"/> setting to <see cref="EditorTheme.OSDefault"/>.
 /// </summary>
 /// <param name="inSender">Determines if the theme is being set or unset.</param>
 /// <param name="inEventArguments">Additional event data.</param>
 private void RadioButtonOSDefaultTheme_CheckedChanged(object inSender, EventArgs inEventArguments)
 {
     if (inSender is RadioButton radioButton &&
         radioButton.Checked)
     {
         CurrentTheme.SetUpTheme(EditorTheme.OSDefault);
         ApplyCurrentTheme();
     }
 }
        protected static void SetCurrentTheme(Theme theme, IThemeColorsBase themeColors, ResourceDictionary themeResources)
        {
            // set the current theme colors that will be referenced by the theme styles
            //CurrentTheme.Instance.ThemeColors = themeColors;
            CurrentTheme.SetTheme(theme, themeColors);

            // merge the XAML based light/dark theme set of styles
            ResourceDictionaryHelper.MergeIntoApplicationResources(themeResources);
        }
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param>
        private void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                // Set the ImageUrl for controls from current Theme
                upBtn.ImageUrl     = CurrentTheme.GetImage("Buttons_Up", "Up.gif").ImageUrl;
                downBtn.ImageUrl   = CurrentTheme.GetImage("Buttons_Down", "Down.gif").ImageUrl;
                deleteBtn.ImageUrl = CurrentTheme.GetImage("Buttons_Delete", "Delete.gif").ImageUrl;
            }
            //TBD: Create a sproc that gets these fields:
            //CreatedBy.Text = (string) dr["CreatedByUser"];
            //CreatedDate.Text = ((DateTime) dr["CreatedDate"]).ToShortDateString();

            // get { QuestionID from querystring
            if (!(Request.Params["QuestionID"] == null))
            {
                int QuestionID = 0;
                QuestionID = int.Parse(Request.Params["QuestionID"]);

                SurveyDB      OptList = new SurveyDB();
                SqlDataReader OList   = OptList.GetOptionList(QuestionID);

                try
                {
                    while (OList.Read())
                    {
                        OptionItem o = new OptionItem();
                        o.OptionName  = OList["OptionDesc"].ToString();
                        o.OptionID    = (int)OList["OptionID"];
                        o.OptionOrder = (int)OList["ViewOrder"];
                        portalOption.Add(o);
                    }
                }
                finally
                {
                    OList.Close(); //by Manu, fixed bug 807858
                }

                if (!Page.IsPostBack)
                {
                    OptionList.DataTextField  = "OptionName";
                    OptionList.DataValueField = "OptionID";
                    OptionList.DataSource     = portalOption;
                    OptionList.DataBind();
                    lblQuestion.Text = Request.Params["Question"];
                    if (Request.Params["TypeOption"] == "RD")
                    {
                        lblTypeOption.Text = General.GetString("SURVEY_RADIOBUTTONS", "Radio buttons", this);
                    }
                    else
                    {
                        lblTypeOption.Text = General.GetString("SURVEY_CHECKBOXES", "Checkboxes", this);
                    }
                }
            }
        }
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param>
        private void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                // Set the ImageUrl for controls from current Theme
                upBtn.ImageUrl     = CurrentTheme.GetImage("Buttons_Up", "Up.gif").ImageUrl;
                downBtn.ImageUrl   = CurrentTheme.GetImage("Buttons_Down", "Down.gif").ImageUrl;
                editBtn.ImageUrl   = CurrentTheme.GetImage("Buttons_Edit", "Edit.gif").ImageUrl;
                deleteBtn.ImageUrl = CurrentTheme.GetImage("Buttons_Delete", "Delete.gif").ImageUrl;
            }

            //*********************************************************
            // Checks whether the survey exist, if not it creates one
            //*********************************************************
            SurveyDB SurveyCheck = new SurveyDB();

            // puts the desc of Survey in the title
            lblDescSurvey.Text = SurveyCheck.ExistAddSurvey(ModuleID, PortalSettings.CurrentUser.Identity.Email);

            //TBD: Create a sproc that gets these fields:
            //CreatedBy.Text = (string) dr["CreatedByUser"];
            //CreatedDate.Text = ((DateTime) dr["CreatedDate"]).ToShortDateString();


            // Fill the Question Listbox
            SurveyDB      QuestionList = new SurveyDB();
            SqlDataReader QList        = QuestionList.GetQuestionList(ModuleID);

            try
            {
                while (QList.Read())
                {
                    QuestionItem t = new QuestionItem();
                    t.QuestionName  = QList["Question"].ToString();
                    t.QuestionID    = (int)QList["QuestionID"];
                    t.QuestionOrder = (int)QList["ViewOrder"];
                    t.TypeOption    = QList["TypeOption"].ToString();
                    portalQuestion.Add(t);
                }
            }
            finally
            {
                QList.Close(); //by Manu, fixed bug 807858
            }

            // if ( this is the first visit to the page, bind the tab data to the page listbox
            if (Page.IsPostBack == false)
            {
                this.QuestionList.DataTextField  = "QuestionName";
                this.QuestionList.DataValueField = "QuestionID";
                this.QuestionList.DataSource     = portalQuestion;
                this.QuestionList.DataBind();
            }
        }
 //*******************************************************
 //
 // The AddOptBtn_Click server event handler is used to add
 // a new option.
 //
 //*******************************************************
 /// <summary>
 /// Handles the Click event of the AddOptBtn control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param>
 protected void AddOptBtn_Click(object sender, EventArgs e)
 {
     lblNewOption.Visible = true;
     TxtNewOption.Visible = true;
     TxtNewOption.Text    = General.GetString("SURVEY_NEWOPTION", "New option", this);
     ReqNewOpt.Visible    = true;
     AddOptionBtn.Text    = "<img src='" + CurrentTheme.GetImage("Buttons_Down", "Down.gif").ImageUrl +
                            "' border=0>" + General.GetString("SURVEY_ADDOPTBELOW", "Add to 'Options' Below", this);
     AddOptionBtn.Visible = true;
     CancelOptBtn.Visible = true;
 }
示例#16
0
        /// <summary>
        /// Registers a highlighting definition for the <see cref="CurrentTheme"/>.
        /// </summary>
        /// <param name="name">The name to register the definition with.</param>
        /// <param name="extensions">The file extensions to register the definition for.</param>
        /// <param name="highlighting">The highlighting definition.</param>
        public void RegisterHighlighting(string name, string[] extensions, IHighlightingDefinition highlighting)
        {
            if (highlighting == null)
            {
                throw new ArgumentNullException("highlighting");
            }

            lock (lockObj)
            {
                CurrentTheme?.RegisterHighlighting(name, extensions, highlighting);
            }
        }
示例#17
0
        /// <summary>
        /// Gets the highlighting definition by name, or null if it is not found.
        /// </summary>
        IHighlightingDefinition IHighlightingDefinitionReferenceResolver.GetDefinition(string name)
        {
            lock (lockObj)
            {
                if (CurrentTheme != null)
                {
                    return(CurrentTheme.GetDefinition(name));
                }

                return(null);
            }
        }
示例#18
0
        void CheckForThemes()
        {
            // if its digital, we dont care about the theme
            if (ShowDigital)
            {
                return;
            }

            // check if we have a 24hr theme available
            bool has24hourtheme = false;

            if (CurrentTheme.EndsWith("-24") || Directory.Exists(ThemePath + "-24"))
            {
                has24hourtheme = true;
            }

            // check if we have a 12hr theme available
            bool has12hourtheme = false;

            if (!CurrentTheme.EndsWith("-24") || Directory.Exists(ThemePath.Substring(0, ThemePath.Length - 3)))
            {
                has12hourtheme = true;
            }

            // make sure military and the theme match
            if (ShowMilitary)
            {
                if (!has24hourtheme)
                {
                    ShowMilitary = false;
                }
                else if (!CurrentTheme.EndsWith("-24"))
                {
                    CurrentTheme = CurrentTheme + "-24";
                }
            }
            else
            {
                if (!has12hourtheme)
                {
                    ShowMilitary = true;
                }
                else if (CurrentTheme.EndsWith("-24"))
                {
                    CurrentTheme = CurrentTheme.Substring(0, CurrentTheme.Length - 3);
                }
            }
        }
 //*******************************************************
 //
 // The AddBtn_Click server event handler is used to add
 // a new question.
 //
 //*******************************************************
 /// <summary>
 /// Handles the Click event of the AddBtn control.
 /// </summary>
 /// <param name="Sender">The source of the event.</param>
 /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param>
 protected void AddBtn_Click(object Sender, EventArgs e)
 {
     lblNewQuestion.Visible = true;
     txtNewQuestion.Visible = true;
     txtNewQuestion.Text    = General.GetString("SURVEY_NEWQUESTION", "New question", this);
     RdBtnCheck.Text        = General.GetString("SURVEY_CHECKBOXES", "Checkboxes", this);
     RdBtnCheck.Visible     = true;
     RdBtnRadio.Text        = General.GetString("SURVEY_RADIOBUTTONS", "Radio buttons", this);
     RdBtnRadio.Visible     = true;
     AddQuestionBtn.Text    = "<img src='" + CurrentTheme.GetImage("Buttons_Down", "Down.gif").ImageUrl +
                              "' border=0>" + General.GetString("SURVEY_ADDBELOW", "Add to 'Questions' Below", this);
     AddQuestionBtn.Visible = true;
     ReqQuestion.Visible    = true;
     lblOptionType.Visible  = true;
     btnCancel.Visible      = true;
 }
示例#20
0
        private async System.Threading.Tasks.Task <(List <CoverageLine> coverageLines, string reportFilePath)> RunAndProcessReportAsync(string[] coverOutputFiles, CancellationToken cancellationToken)
        {
            cancellationToken.ThrowIfCancellationRequested();

            List <CoverageLine> coverageLines = null;
            string reportFilePath             = null;

            var darkMode = CurrentTheme.Equals("Dark", StringComparison.OrdinalIgnoreCase);

            var result = await reportGeneratorUtil.RunReportGeneratorAsync(coverOutputFiles, darkMode, true);

            if (result.Success)
            {
                coberturaUtil.ProcessCoberturaXmlFile(result.UnifiedXmlFile);
                coverageLines = coberturaUtil.CoverageLines;

                reportGeneratorUtil.ProcessUnifiedHtmlFile(result.UnifiedHtmlFile, darkMode, out var htmlFilePath);
                reportFilePath = htmlFilePath;
            }
            return(coverageLines, reportFilePath);
        }
示例#21
0
        private static void ReloadCoverage(List <CoverageProject> projects)
        {
            Logger.Log("================================== START ==================================");

            Reset();

            var coverageTask = System.Threading.Tasks.Task.Run(async() =>
            {
                // process pipeline

                await PrepareCoverageProjectsAsync(projects);

                foreach (var project in projects)
                {
                    cancellationToken.ThrowIfCancellationRequested();
                    await project.StepAsync("Run Coverage Tool", RunCoverToolAsync);
                }

                var passedProjects = projects.Where(x => !x.HasFailed);

                var coverOutputFiles = passedProjects
                                       .Select(x => x.CoverageOutputFile)
                                       .ToArray();

                if (coverOutputFiles.Any())
                {
                    cancellationToken.ThrowIfCancellationRequested();
                    // run reportGenerator process

                    var darkMode = CurrentTheme.Equals("Dark", StringComparison.OrdinalIgnoreCase);

                    var result = await ReportGeneratorUtil.RunReportGeneratorAsync(coverOutputFiles, darkMode, true);

                    if (result.Success)
                    {
                        // update CoverageLines

                        CoverageReport = CoberturaUtil.ProcessCoberturaXmlFile(result.UnifiedXmlFile, out var coverageLines);
                        CoverageLines  = coverageLines;
                        // update HtmlFilePath

                        ReportGeneratorUtil.ProcessUnifiedHtmlFile(result.UnifiedHtmlFile, darkMode, out var htmlFilePath);
                        HtmlFilePath = htmlFilePath;
                    }

                    // update margins

                    {
                        UpdateMarginTagsEventArgs updateMarginTagsEventArgs = null;

                        try
                        {
                            updateMarginTagsEventArgs = new UpdateMarginTagsEventArgs
                            {
                            };
                        }
                        catch
                        {
                            // ignore
                        }
                        finally
                        {
                            UpdateMarginTags?.Invoke(updateMarginTagsEventArgs);
                        }
                    }

                    // update output window

                    {
                        UpdateOutputWindowEventArgs updateOutputWindowEventArgs = null;

                        try
                        {
                            if (!string.IsNullOrEmpty(HtmlFilePath))
                            {
                                updateOutputWindowEventArgs = new UpdateOutputWindowEventArgs
                                {
                                    HtmlContent = File.ReadAllText(HtmlFilePath)
                                };
                            }
                        }
                        catch
                        {
                            // ignore
                        }
                        finally
                        {
                            UpdateOutputWindow?.Invoke(updateOutputWindowEventArgs);
                        }
                    }
                }


                // log

                Logger.Log("================================== DONE ===================================");

                cancellationTokenSource.Dispose();
                cancellationTokenSource = null;
            }, cancellationToken);
        }
示例#22
0
        public void AddTheme()
        {
            if (Themes != null)
            {
                var theme = Themes.Count == 0 || CurrentTheme == null?DefaultTheme?.Clone() : CurrentTheme?.Clone();

                if (theme != null)
                {
                    if (Themes.Count > 0 && Themes.Count(x => x.Name == theme.Name) > 0)
                    {
                        theme.Name += "-copy";
                    }
                    AddTheme(theme);
                }
            }
        }
 private void TouchButton_ButtonTap(object sender, RoutedEventArgs e)
 {
    Theme++;
    if ((int)Theme > 1)
        Theme = 0;
     if(Theme.Equals(CurrentTheme.Generic))
     {
         var dic = new ResourceDictionary { Source = SofthinkCore.Utils.UtilsHelper.CreateUri("Themes/generic.xaml", "SofthinkCore") };
         Application.Current.Resources.MergedDictionaries.Clear();
         Application.Current.Resources.MergedDictionaries.Add(dic);
         //keyboard.Style = (Style)dic[typeof(KeyboardControl)];
     }
     else
     {
         var dic =  new ResourceDictionary { Source = SofthinkCore.Utils.UtilsHelper.CreateUri("Themes/IOS.xaml","SofthinkCore") };
         //keyboard.Style = (Style) dic[typeof(KeyboardControl)];
         Application.Current.Resources.MergedDictionaries.Clear();
         Application.Current.Resources.MergedDictionaries.Add(dic);
     }
    
 }
示例#24
0
 public static Color GetContextDisabledForeColor(ColorContexts colorContext)
 {
     return(CurrentTheme.GetContextForeColor(colorContext).Lerp(Color.Gray, 0.5));
 }
        /// <summary>
        /// The Page_Load event handler on this User Control is used to
        /// obtain a DataReader of link information from the EnhancedLinks
        /// table, and then databind the results to a templated DataList
        /// server control.  It uses the Rainbow.EnhancedLinkDB()
        /// data component to encapsulate all data functionality.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param>
        private void Page_Load(object sender, EventArgs e)
        {
            string iconContainer = Settings["ENHANCEDLINKS_ICONPATH"].ToString();
            string defaultImage  = Settings["ENHANCEDLINKS_DEFAULTIMAGE"].ToString();
            bool   dropDownList  = Settings["ENHANCEDLINKS_SWITCHERTYPES"].ToString().Equals("1");
            bool   doExpandAll   = bool.Parse(Settings["ENHANCEDLINKS_EXPANDALL"].ToString());
            int    maxColumns    = int.Parse(Settings["ENHANCEDLINKS_MAXCOLUMS"].ToString());
            int    actualColumn  = 1;

            if (dropDownList)
            {
                if (!Page.IsPostBack)
                {
                    results.Visible         = false;
                    cboLinks.Visible        = true;
                    cboLinks.DataSource     = mountDataList();
                    cboLinks.DataTextField  = "TextField";
                    cboLinks.DataValueField = "ValueField";
                    cboLinks.SelectedIndex  = 0;
                    cboLinks.DataBind();
                }
                return;
            }
            int            itemCount     = 0;
            EnhancedLinkDB enhancedLinks = new EnhancedLinkDB();
            StringBuilder  listStr       = new StringBuilder();

            listStr.Append("<table border=0 cellspacing=5 cellpadding=0>");
            SqlDataReader dr = enhancedLinks.GetEnhancedLinks(ModuleID, Version);

            listStr.Append("<tr>");

            while (dr.Read())
            {
                string imageStr    = (string)dr["ImageURL"];
                string linkStr     = (string)dr["Url"];
                string titleStr    = (string)dr["Title"];
                string descStr     = (string)dr["Description"];
                string targetStr   = (string)dr["Target"];
                bool   isSeparator = linkStr.Equals("SEPARATOR");

                if (isSeparator)
                {
                    listStr.Append("<td>&nbsp;</td></tr><tr>");
                    actualColumn = 1;
                }
                if (IsEditable)
                {
                    listStr.Append("<td><a href=\"" + GetLinkUrl(dr["ItemID"].ToString(), linkStr, true) +
                                   "\"><img src='" + CurrentTheme.GetImage("Buttons_Edit", "Edit.gif").ImageUrl +
                                   "' border=0></a>&nbsp;</td>");
                }
                string auxImage;
                if ((imageStr != null) && (imageStr.Length > 0))
                {
                    auxImage = portalSettings.PortalFullPath + "/" + iconContainer + "/" + imageStr;
                }
                else if ((defaultImage != null) && (defaultImage.Length > 0))
                {
                    auxImage = portalSettings.PortalFullPath + "/" + iconContainer + "/" + defaultImage;
                }
                else
                {
                    auxImage = CurrentTheme.GetImage("NavLink", "navlink.gif").ImageUrl;
                }
                string altStr = string.Empty;
                if ((descStr != null) && (descStr.Length > 0))
                {
                    altStr = " title='" + descStr + "'";
                }
                targetStr = " target='" + targetStr + "'";
                listStr.Append("<td valign=center align=center><img src='" + auxImage + "' border=0></td>");
                if (isSeparator)
                {
                    listStr.Append("<td valign=center><a class='EnhancedTitle'>" + titleStr +
                                   "</a></td></tr><tr><td colspan=40><hr></td></tr><tr>");
                }
                else
                {
                    listStr.Append("<td valign=center><a class='EnhancedLink' href='" + GetLinkUrl(null, linkStr, false) +
                                   "'" + targetStr + altStr + ">" + titleStr + "</a>");
                    if ((doExpandAll) && (descStr != null) && (descStr.Length > 0))
                    {
                        listStr.Append("<br>" + "<a class='EnhancedDescription'>" + descStr + "</a>");
                    }
                }
                if (!isSeparator)
                {
                    listStr.Append("</td>");
                    if (actualColumn < maxColumns)
                    {
                        listStr.Append("<td>&nbsp;</td>");
                        actualColumn++;
                    }
                    else
                    {
                        listStr.Append("</tr>");
                        actualColumn = 1;
                    }
                }
                itemCount++;
            }
            dr.Close();

            listStr.Append("</tr>");
            listStr.Append("</table>\r\n");

            if (itemCount > 0)
            {
                results.Visible = true;
                results.Controls.Add(ParseControl(listStr.ToString()));
            }
        }
示例#26
0
 public static Color GetContextDisabledBorderColor(ColorContexts colorContext)
 {
     return(CurrentTheme.GetContextBorderColor(colorContext).Lerp(Color.LightGray, 0.75));
 }
示例#27
0
 public void Dispose()
 {
     CurrentTheme.Dispose();
 }
示例#28
0
 public void Update(GameTime gameTime)
 {
     CurrentTheme.Update(gameTime);
 }
示例#29
0
 public static void ToggleDistractionFree(object obj)
 {
     CurrentTheme.ToggleDistractions();
 }
示例#30
0
 /// <summary>
 /// Gets the local image.
 /// </summary>
 /// <param name="img">The img.</param>
 /// <returns></returns>
 protected string getLocalImage(string img)
 {
     return(CurrentTheme.GetModuleImageSRC(img));
 }
        public void AddCommand()
        {
            var theme = Themes.Count == 0 || CurrentTheme == null?DefaultTheme.Clone() : CurrentTheme.Clone();

            if (Themes.Count > 0 && Themes.Count(x => x.Name == theme.Name) > 0)
            {
                theme.Name += "-copy";
            }
            Add(theme);
        }