Esempio n. 1
0
        /// <summary>
        ///     Map method
        /// </summary>
        /// <param name="themeView">themeView instance</param>
        /// <returns>instance of Theme (for BLL)</returns>
        public static Theme Map(this ThemeView themeView)
        {
            var resultTheme = new Theme
            {
                ThemeId = themeView.ThemeEntityId,
                Name    = themeView.Name
            };

            return(resultTheme);
        }
Esempio n. 2
0
        /// <summary>
        ///     map method
        /// </summary>
        /// <param name="theme">theme instance</param>
        /// <param name="count">count of courses</param>
        /// <returns></returns>
        public static ThemeView Map(this Theme theme)
        {
            var resultTheme = new ThemeView
            {
                ThemeEntityId = theme.ThemeId,
                Name          = theme.Name,
                CourseCount   = theme.CourseCount
            };

            return(resultTheme);
        }
Esempio n. 3
0
        public ActionResult Add(ThemeView theme)
        {
            var result = _themeService.AddTheme(theme.Map());

            if (result != null)
            {
                TempData["Success"] = "Theme successfully created!";
                Logger.Log.Info($"Theme with Name - {theme.Name}, created successfully.");
                return(RedirectToAction("List"));
            }
            Logger.Log.Info($"Theme with Name - {theme.Name}, already exists!");
            TempData["Error"] = "Theme already exists!";
            return(View());
        }
Esempio n. 4
0
        private void RenderSingleTheme(ThemeView t, StringBuilder sb)
        {
            string url = t.PreviewImageUrl;

            if (!url.StartsWith("http"))
            {
                url = Page.ResolveUrl("~" + t.PreviewImageUrl);
            }

            sb.Append("<img class=\"smallpreview\" src=\"" + url + "?uid=" + System.Guid.NewGuid().ToString() + "\" alt=\"" + t.Info.Title + "\" />");
            sb.Append("<h3>" + t.Info.Title + "</h3>");
            sb.Append("<label>Author:</label><span class=\"author\"><a href=\"" + t.Info.AuthorUrl + "\" target=\"_blank\">" + t.Info.Author + "</a></span><br />");
            sb.Append("<label>Version:</label><span class=\"author\">" + t.Info.Version + "</span><br />");
        }
Esempio n. 5
0
        public ActionResult Edit(ThemeView theme)
        {
            var result = _themeService.Edit(theme.Map());

            if (result != null)
            {
                TempData["Success"] = "Theme successfully modified!";
                Logger.Log.Info($"Theme with Name - {theme.Name}, modified.");
                return(RedirectToAction("List"));
            }

            ModelState.AddModelError("Name", "Theme already exists!");
            Logger.Log.Info($"Theme with Name - {theme.Name}, wasn`t modified!");
            TempData["Error"] = "Theme wasn`t modified!";
            return(View());
        }
Esempio n. 6
0
        public override void ViewWillAppear(bool animated)
        {
            base.ViewWillAppear(animated);

            LOTAnimatedSwitch lottie = LOTAnimatedSwitch.SwitchNamed("nightmode");
            float             state1 = Semdelion.Core.User.Settings.ModeNight ? 0.9f : 0.5f;
            float             state2 = Semdelion.Core.User.Settings.ModeNight ? 0.5f : 0.1f;

            lottie.SetProgressRangeForOnState(state2, state1);
            lottie.SetProgressRangeForOffState(state1, state2);
            lottie.ContentMode = UIViewContentMode.ScaleToFill;
            lottie.Frame       = new CoreGraphics.CGRect(0, 0, ThemeView.Frame.Width, ThemeView.Frame.Height);

            ThemeView.AddSubview(lottie);
            lottie.ValueChanged += (sender, e) =>
            {
                var window = UIApplication.SharedApplication.Windows[0];
                window.OverrideUserInterfaceStyle      = Semdelion.Core.User.Settings.ModeNight ? UIUserInterfaceStyle.Light : UIUserInterfaceStyle.Dark;
                Semdelion.Core.User.Settings.ModeNight = !Semdelion.Core.User.Settings.ModeNight;
            };
        }
Esempio n. 7
0
 public void Themeinit()
 {
     if (partchar == '左')
     {
         defaulttheme     = "老营隧道左幅施工进度图";
         profilethemeview = new ThemeView("左幅剖面图");
         profilethemelist = new List <string>()
         {
             "老营隧道左幅施工进度图", "老营隧道左幅地质剖面图", "老营隧道左幅衬砌结构图", "老营隧道左幅物探图"
         };
     }
     else
     {
         defaulttheme     = "老营隧道右幅施工进度图";
         profilethemeview = new ThemeView("右幅剖面图");
         profilethemelist = new List <string>()
         {
             "老营隧道右幅施工进度图", "老营隧道右幅地质剖面图", "老营隧道右幅衬砌结构图", "老营隧道右幅物探图"
         };
     }
     LayerToGeofile = new Dictionary <string, string>();
     Loadcsvfile();
 }
Esempio n. 8
0
        private void LoadTheInfo(string themeId)
        {
            if ((themeId == null))
            {
                return;
            }

            ThemeInfo info = MTApp.ThemeManager().GetThemeInfo(themeId);

            if ((info != null))
            {
                this.ThemeNameField.Text   = info.Title;
                this.DescriptionField.Text = info.Description;
                this.AuthorField.Text      = info.Author;
                this.AuthorUrlField.Text   = info.AuthorUrl;
                this.VersionField.Text     = info.Version;
                this.VersionUrlField.Text  = info.VersionUrl;

                ThemeView tv = new ThemeView();
                tv.LoadInstalledTheme(MTApp, themeId);
                this.imgPreview.ImageUrl = tv.PreviewImageUrl + "?uid=" + System.Guid.NewGuid().ToString();
            }
        }
Esempio n. 9
0
        public LayersWindow(ThemeView themeview, LayerCollection layers)
        {
            InitializeComponent();

            //Initialize the checkboxs based on themesections and themelayers
            layeritems = new List <LayerItem>();
            foreach (ThemeSection themsection in themeview.themesections)
            {
                CheckBox _themebox = themecheckbox(themsection.name);
                this.addCheckbox.Children.Add(_themebox);
                LayerItem _themelayeritem = new LayerItem();
                _themelayeritem.checkbox = _themebox;

                _themelayeritem.themesection = themsection;
                layeritems.Add(_themelayeritem);

                //增加有tpk对应的复选框
                foreach (ThemeLayer themelayer in themsection.themelayers)
                {
                    string st = themelayer.tpkname;
                    if (st.Contains("无tpk"))
                    {
                        st = st.Split('-')[0];
                    }
                    CheckBox _layerbox = layerbox(st);
                    this.addCheckbox.Children.Add(_layerbox);
                    LayerItem _layeritem = new LayerItem();
                    _layeritem.checkbox = _layerbox;

                    _layeritem.themelayer = themelayer;
                    _layeritem.parent     = _themelayeritem;
                    layeritems.Add(_layeritem);
                    _themelayeritem.childs.Add(_layeritem);
                }
            }
        }