public HttpResponseMessage update_theme(CustomTheme post)
        {
            // Check for errors
            if (post == null)
            {
                return Request.CreateResponse<string>(HttpStatusCode.BadRequest, "The post is null");
            }

            // Make sure that the data is valid
            post.name = AnnytabDataValidation.TruncateString(post.name, 100);

            // Get the saved post
            CustomTheme savedPost = CustomTheme.GetOneById(post.id);

            // Check if the post exists
            if (savedPost == null)
            {
                return Request.CreateResponse<string>(HttpStatusCode.BadRequest, "The record does not exist");
            }

            // Update the post
            CustomTheme.Update(post);

            // Return the success response
            return Request.CreateResponse<string>(HttpStatusCode.OK, "The update was successful");

        } // End of the update_theme method
Esempio n. 2
0
    // Use this for initialization
    void Start()
    {
        Prompt = GameObject.Find("Prompts");
        System = GameObject.Find("System");

        ComAddress   = "S:/Settings";
        windowRect.x = Customize.cust.windowx[windowID];
        windowRect.y = Customize.cust.windowy[windowID];

        ep     = Prompt.GetComponent <ErrorProm>();
        def    = System.GetComponent <Defalt>();
        com    = System.GetComponent <Computer>();
        os     = System.GetComponent <OS>();
        desk   = System.GetComponent <Desktop>();
        ct     = System.GetComponent <CustomTheme>();
        mouse  = System.GetComponent <Mouse>();
        appman = System.GetComponent <AppMan>();
        ss     = System.GetComponent <ScreenSaver>();
        sc     = System.GetComponent <SoundControl>();

        TempName = "";
        TempPass = "";
        UpdateRezList();
        AddTime();
        SetPos();

        Scale = Customize.cust.UIScale;

        windowRect.x = Screen.width - windowRect.width - 1;
        windowRect.y = 50;
    }
Esempio n. 3
0
    public static Int32 DATABASE_VERSION = 6; // The version number is +1 compared to the file version number

    #endregion

    #region Upgrade methods

    /// <summary>
    /// Upgrade the database to the current version
    /// </summary>
    public static void UpgradeDatabase()
    {
        // Get the current database version
        Int32 currentDatabaseVersion = GetDatabaseVersion();

        // Loop and upgrade database versions
        for (int i = currentDatabaseVersion; i < DATABASE_VERSION; i++)
        {
            // Upgrade the database
            bool success = UpgradeToVersion(i);
        }

        // Get all the custom themes
        List<CustomTheme> customThemes = CustomTheme.GetAll("id", "ASC");

        // Check if we should add newly added templates
        for (int i = 0; i < customThemes.Count; i++)
        {
            CustomTheme.AddCustomThemeTemplates(customThemes[i].id);
        }

        // Save database version information
        SetDatabaseVersion(DATABASE_VERSION);

    } // End of the UpgradeDatabase version
Esempio n. 4
0
        /// <summary>
        /// 自定义主题
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnDiyTheme_Click(object sender, EventArgs e)
        {
            CustomTheme custom = new CustomTheme();

            custom.ShowDialog();
            loadTheme();
        }
Esempio n. 5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //Set up the map. We use the method in the App_Code folder for initializing the map and alter it afterwards
        myMap = MapHelper.InitializeMap(new System.Drawing.Size((int)imgMap.Width.Value, (int)imgMap.Height.Value));
        //Remove the river layer and label-layers
        myMap.Layers.RemoveAt(4);
        myMap.Layers.RemoveAt(3);
        myMap.Layers.RemoveAt(1);

        //Create Pie Layer
        SharpMap.Layers.VectorLayer pieLayer = new SharpMap.Layers.VectorLayer("Pie charts");
        pieLayer.DataSource = (myMap.Layers[0] as SharpMap.Layers.VectorLayer).DataSource;
        CustomTheme <IVectorStyle> iTheme = new CustomTheme <IVectorStyle>(GetCountryStyle);

        pieLayer.Theme = iTheme;
        myMap.Layers.Add(pieLayer);

        if (Page.IsPostBack)
        {
            //Page is post back. Restore center and zoom-values from viewstate
            myMap.Center = (SharpMap.Geometries.Point)ViewState["mapCenter"];
            myMap.Zoom   = (double)ViewState["mapZoom"];
        }
        else
        {
            //This is the initial view of the map. Zoom to the extents of the map:
            //myMap.ZoomToExtents();
            myMap.Center = new SharpMap.Geometries.Point(10, 50);
            myMap.Zoom   = 60;
            //Create the map
            GenerateMap();
        }
    }
Esempio n. 6
0
 public void StartThemeSwitch(float time, OSTheme newTheme, object osobj, string customThemePath = null)
 {
     this.oldTheme       = ThemeManager.currentTheme;
     this.oldThemePath   = this.oldTheme == OSTheme.Custom ? ThemeManager.LastLoadedCustomThemePath : (string)null;
     this.oldCustomTheme = this.oldTheme == OSTheme.Custom ? ThemeManager.LastLoadedCustomTheme : (CustomTheme)null;
     if ((double)this.themeSwapTimeRemaining > 0.0)
     {
         this.CompleteThemeSwap(osobj);
     }
     this.originalThemeSwapTime = this.themeSwapTimeRemaining = time;
     this.newTheme     = newTheme;
     this.newThemePath = customThemePath;
     try
     {
         if ((double)time <= 0.0)
         {
             this.CompleteThemeSwap(osobj);
         }
         else if (this.newThemePath != null)
         {
             ThemeManager.switchTheme(osobj, this.newThemePath);
             this.newCustomTheme = ThemeManager.LastLoadedCustomTheme;
         }
         else
         {
             this.newCustomTheme = (CustomTheme)null;
         }
     }
     catch (Exception ex)
     {
         time = this.themeSwapTimeRemaining = 0.0f;
         throw ex;
     }
 }
Esempio n. 7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //Set up the map. We use the method in the App_Code folder for initializing the map
        myMap = MapHelper.InitializeMap(new Size((int)imgMap.Width.Value, (int)imgMap.Height.Value));
        //Set a gradient theme on the countries layer, based on Population density
        CustomTheme iTheme       = new CustomTheme(GetCountryStyle);
        VectorStyle defaultstyle = new VectorStyle();

        defaultstyle.Fill   = Brushes.Gray;
        iTheme.DefaultStyle = defaultstyle;
        (myMap.Layers[0] as VectorLayer).Theme = iTheme;
        //Turn off the river layer and label-layers
        myMap.Layers[1].Enabled = false;
        myMap.Layers[3].Enabled = false;
        myMap.Layers[4].Enabled = false;

        if (Page.IsPostBack)
        {
            //Page is post back. Restore center and zoom-values from viewstate
            myMap.Center = (Point)ViewState["mapCenter"];
            myMap.Zoom   = (double)ViewState["mapZoom"];
        }
        else
        {
            //This is the initial view of the map. Zoom to the extents of the map:
            //myMap.ZoomToExtents();
            myMap.Center = new Point(0, 0);
            myMap.Zoom   = 360;
            //Create the map
            GenerateMap();
        }
    }
Esempio n. 8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //Set up the map. We use the method in the App_Code folder for initializing the map and alter it afterwards
        myMap = MapHelper.InitializeMap(new System.Drawing.Size((int)imgMap.Width.Value, (int)imgMap.Height.Value));
        //Remove the river layer and label-layers
        myMap.Layers.RemoveAt(4);
        myMap.Layers.RemoveAt(3);
        myMap.Layers.RemoveAt(1);

        //Create Pie Layer
        SharpMap.Layers.VectorLayer pieLayer = new SharpMap.Layers.VectorLayer("Pie charts");
        pieLayer.DataSource = (myMap.Layers[0] as SharpMap.Layers.VectorLayer).DataSource;
        CustomTheme<IVectorStyle> iTheme = new CustomTheme<IVectorStyle>(GetCountryStyle);
        pieLayer.Theme = iTheme;
        myMap.Layers.Add(pieLayer);

        if (Page.IsPostBack)
        {
            //Page is post back. Restore center and zoom-values from viewstate
            myMap.Center = (SharpMap.Geometries.Point)ViewState["mapCenter"];
            myMap.Zoom = (double)ViewState["mapZoom"];
        }
        else
        {
            //This is the initial view of the map. Zoom to the extents of the map:
            //myMap.ZoomToExtents();
            myMap.Center = new SharpMap.Geometries.Point(10, 50);
            myMap.Zoom = 60;
            //Create the map
            GenerateMap();
        }
    }
Esempio n. 9
0
        public HttpResponseMessage update_theme(CustomTheme post)
        {
            // Check for errors
            if (post == null)
            {
                return(Request.CreateResponse <string>(HttpStatusCode.BadRequest, "The post is null"));
            }

            // Make sure that the data is valid
            post.name = AnnytabDataValidation.TruncateString(post.name, 100);

            // Get the saved post
            CustomTheme savedPost = CustomTheme.GetOneById(post.id);

            // Check if the post exists
            if (savedPost == null)
            {
                return(Request.CreateResponse <string>(HttpStatusCode.BadRequest, "The record does not exist"));
            }

            // Update the post
            CustomTheme.Update(post);

            // Return the success response
            return(Request.CreateResponse <string>(HttpStatusCode.OK, "The update was successful"));
        } // End of the update_theme method
Esempio n. 10
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //Set up the map. We use the method in the App_Code folder for initializing the map
        myMap = MapHelper.InitializeMap(new System.Drawing.Size((int)imgMap.Width.Value, (int)imgMap.Height.Value));
        //Set a gradient theme on the countries layer, based on Population density
        CustomTheme<IVectorStyle> iTheme = new CustomTheme<IVectorStyle>(GetCountryStyle);
        IVectorStyle defaultstyle = new VectorStyle();
        defaultstyle.Fill = Brushes.Gray;
        iTheme.DefaultStyle = defaultstyle;
        (myMap.Layers[0] as SharpMap.Layers.VectorLayer).Theme = iTheme;
        //Turn off the river layer and label-layers
        myMap.Layers[1].Enabled = false;
        myMap.Layers[3].Enabled = false;
        myMap.Layers[4].Enabled = false;

        if (Page.IsPostBack)
        {
            //Page is post back. Restore center and zoom-values from viewstate
            myMap.Center = (SharpMap.Geometries.Point)ViewState["mapCenter"];
            myMap.Zoom = (double)ViewState["mapZoom"];
        }
        else
        {
            //This is the initial view of the map. Zoom to the extents of the map:
            //myMap.ZoomToExtents();
            myMap.Center = new SharpMap.Geometries.Point(0, 0);
            myMap.Zoom = 360;
            //Create the map
            GenerateMap();
        }
    }
Esempio n. 11
0
    } // End of the AddTemplate method

    #endregion

    #region Update methods

    /// <summary>
    /// Update a custom theme post
    /// </summary>
    /// <param name="post">A reference to a custom theme post</param>
    public static void Update(CustomTheme post)
    {
        // Create the connection and the sql statement
        string connection = Tools.GetConnectionString();
        string sql = "UPDATE dbo.custom_themes SET name = @name WHERE id = @id;";

        // The using block is used to call dispose automatically even if there are an exception.
        using (SqlConnection cn = new SqlConnection(connection))
        {
            // The using block is used to call dispose automatically even if there are an exception.
            using (SqlCommand cmd = new SqlCommand(sql, cn))
            {
                // Add parameters
                cmd.Parameters.AddWithValue("@id", post.id);
                cmd.Parameters.AddWithValue("@name", post.name);

                // The Try/Catch/Finally statement is used to handle unusual exceptions in the code to
                // avoid having our application crash in such cases.
                try
                {
                    // Open the connection.
                    cn.Open();

                    // Execute the update
                    cmd.ExecuteNonQuery();

                }
                catch (Exception e)
                {
                    throw e;
                }
            }
        }

    } // End of the Update method
Esempio n. 12
0
        private static themeCustom GetThemeCustom(CustomTheme theme)
        {
            string defaultStyle = GetDefaultStyle(theme);

            return(new themeCustom {
                defaultStyle = defaultStyle
            });
        }
Esempio n. 13
0
        public CustomTheme get_theme_by_id(Int32 id = 0)
        {
            // Create the post to return
            CustomTheme post = CustomTheme.GetOneById(id);

            // Return the post
            return(post);
        } // End of the get_theme_by_id method
Esempio n. 14
0
        public List <CustomTheme> get_all_themes(string sortField = "", string sortOrder = "")
        {
            // Create the list to return
            List <CustomTheme> posts = CustomTheme.GetAll(sortField, sortOrder);

            // Return the list
            return(posts);
        } // End of the get_all_themes method
Esempio n. 15
0
        public HttpResponseMessage delete_template(Int32 id = 0, string userFileName = "")
        {
            // Delete the post
            CustomTheme.DeleteTemplateOnId(id, userFileName);

            // Return the success response
            return(Request.CreateResponse <string>(HttpStatusCode.OK, "The delete was successful"));
        } // End of the delete_template method
Esempio n. 16
0
        public VectorLayer getPolygonPoints(PointF points, VectorLayer veclayer)
        {
            //VectorLayer veclayer = (VectorLayer)m_viewBox.Map.GetLayerByName("province");
            SharpMap.Layers.VectorLayer laySelected = new SharpMap.Layers.VectorLayer("Selection");;
            CustomTheme myTheme = new CustomTheme(FeatureColoured);
            ShapeFile   vecshp  = (ShapeFile)veclayer.DataSource;
            ShapeFile   shp     = vecshp;

            if (!shp.IsOpen)
            {
                shp.Open();
            }

            FeatureDataSet   featDataSet   = new FeatureDataSet();
            FeatureDataTable featDataTable = null;
            //将point的大地坐标转为经纬度
            Projection pj = new Projection();

            points = pj.GetLatLonFromXY(points, cfg.pjPara);


            //   获取feature数量
            uint featCount = (uint)shp.GetFeatureCount();

            for (uint index = 0; index < featCount; index++)
            {
                FeatureDataRow r = shp.GetFeature(index);
                GeoAPI.Geometries.Coordinate[] geomes = r.Geometry.Coordinates;
                double[] geomsX = new double[geomes.Length];
                double[] geomsY = new double[geomes.Length];
                for (int j = 0; j < geomes.Length; j++)
                {
                    geomsX[j] = geomes[j].X;
                    geomsY[j] = geomes[j].Y;
                }

                if ((points.X < geomsX.Min()) || (points.X > geomsX.Max()) || (points.Y < geomsY.Min()) || (points.Y > geomsY.Max()))
                {
                    continue;
                }

                PointF p1 = new PointF();
                p1.X = points.X;
                p1.Y = points.Y;
                if (InPolygon(geomes, p1))
                {
                    //首先把geomes传出去,供其他使用
                    ContourGeomes = geomes;
                    //如果在某区域内,选中某个区域,放入新图层
                    laySelected.DataSource = new SharpMap.Data.Providers.GeometryProvider(shp.GetFeature(index));
                    polygon = ((NetTopologySuite.Geometries.Polygon)r.Geometry);
                    laySelected.Style.Fill = new System.Drawing.SolidBrush(Color.HotPink);
                    laySelected.CoordinateTransformation = veclayer.CoordinateTransformation;
                }
            }
            return(laySelected);
        }
Esempio n. 17
0
    } // End of the MasterPostExists method

    /// <summary>
    /// Get one custom theme based on id
    /// </summary>
    /// <param name="id">The id</param>
    /// <returns>A reference to a custom theme post</returns>
    public static CustomTheme GetOneById(Int32 id)
    {
        // Create the post to return
        CustomTheme post = null;

        // Create the connection and the sql statement
        string connection = Tools.GetConnectionString();
        string sql = "SELECT * FROM dbo.custom_themes WHERE id = @id;";

        // The using block is used to call dispose automatically even if there is a exception.
        using (SqlConnection cn = new SqlConnection(connection))
        {
            // The using block is used to call dispose automatically even if there is a exception.
            using (SqlCommand cmd = new SqlCommand(sql, cn))
            {
                // Add a parameters
                cmd.Parameters.AddWithValue("@id", id);

                // Create a MySqlDataReader
                SqlDataReader reader = null;

                // The Try/Catch/Finally statement is used to handle unusual exceptions in the code to
                // avoid having our application crash in such cases.
                try
                {
                    // Open the connection.
                    cn.Open();

                    // Fill the reader with one row of data.
                    reader = cmd.ExecuteReader();

                    // Loop through the reader as long as there is something to read and add values
                    while (reader.Read())
                    {
                        post = new CustomTheme(reader);
                    }
                }
                catch (Exception e)
                {
                    throw e;
                }
                finally
                {
                    // Call Close when done reading to avoid memory leakage.
                    if (reader != null)
                        reader.Close();
                }
            }
        }

        // Return the post
        return post;

    } // End of the GetOneById method
Esempio n. 18
0
        public HttpResponseMessage add(Domain post)
        {
            // Check for errors
            if (post == null)
            {
                return(Request.CreateResponse <string>(HttpStatusCode.BadRequest, "The post is null"));
            }
            else if (Country.MasterPostExists(post.country_id) == false)
            {
                return(Request.CreateResponse <string>(HttpStatusCode.BadRequest, "The country does not exist"));
            }
            else if (Language.MasterPostExists(post.front_end_language) == false)
            {
                return(Request.CreateResponse <string>(HttpStatusCode.BadRequest, "The front end language does not exist"));
            }
            else if (Language.MasterPostExists(post.back_end_language) == false)
            {
                return(Request.CreateResponse <string>(HttpStatusCode.BadRequest, "The back end language does not exist"));
            }
            else if (Currency.MasterPostExists(post.currency) == false)
            {
                return(Request.CreateResponse <string>(HttpStatusCode.BadRequest, "The currency does not exist"));
            }
            else if (Company.MasterPostExists(post.company_id) == false)
            {
                return(Request.CreateResponse <string>(HttpStatusCode.BadRequest, "The company does not exist"));
            }
            else if (post.custom_theme_id != 0 && CustomTheme.MasterPostExists(post.custom_theme_id) == false)
            {
                return(Request.CreateResponse <string>(HttpStatusCode.BadRequest, "The theme does not exist"));
            }
            else if (Domain.GetOneByDomainName(post.domain_name) != null)
            {
                return(Request.CreateResponse <string>(HttpStatusCode.BadRequest, "The domain name is not unique"));
            }

            // Make sure that the data is valid
            post.webshop_name          = AnnytabDataValidation.TruncateString(post.webshop_name, 100);
            post.domain_name           = AnnytabDataValidation.TruncateString(post.domain_name, 100);
            post.web_address           = AnnytabDataValidation.TruncateString(post.web_address, 100);
            post.analytics_tracking_id = AnnytabDataValidation.TruncateString(post.analytics_tracking_id, 50);
            post.facebook_app_id       = AnnytabDataValidation.TruncateString(post.facebook_app_id, 50);
            post.facebook_app_secret   = AnnytabDataValidation.TruncateString(post.facebook_app_secret, 50);
            post.google_app_id         = AnnytabDataValidation.TruncateString(post.google_app_id, 100);
            post.google_app_secret     = AnnytabDataValidation.TruncateString(post.google_app_secret, 50);

            // Add the post
            Domain.Add(post);

            // Return the success response
            return(Request.CreateResponse <string>(HttpStatusCode.OK, "The post has been added"));
        } // End of the add method
Esempio n. 19
0
        public async Task <int> UpsertAsync(int themeId, string themeName, int titleFontId, int textFontId, int largeTitleFontSize, int mediumTitleFontSize, int smallTitleFontSize, int tinyTitleFontSize, int textStandardFontSize, string pageBackgroundColour, string menuBackgroundColour, string menuTextColour)
        {
            var existingTheme = await GetAsync(themeId);

            if (existingTheme == null)
            {
                var newTheme = new CustomTheme
                {
                    ThemeName            = themeName,
                    TitleFontId          = titleFontId,
                    TextFontId           = textFontId,
                    DateAdded            = DateTime.Now,
                    DateUpdated          = DateTime.Now,
                    TitleLargeFontSize   = largeTitleFontSize,
                    TitleMediumFontSize  = mediumTitleFontSize,
                    TitleSmallFontSize   = smallTitleFontSize,
                    TitleTinyFontSize    = tinyTitleFontSize,
                    TextStandardFontSize = textStandardFontSize,
                    PageBackgroundColour = pageBackgroundColour,
                    MenuBackgroundColour = menuBackgroundColour,
                    MenuTextColour       = menuTextColour,
                    IsDefault            = false,
                };

                _context.Themes.Add(newTheme);

                await _context.SaveChangesAsync();

                return(newTheme.ThemeId);
            }
            else
            {
                existingTheme.ThemeName            = themeName;
                existingTheme.TitleFontId          = titleFontId;
                existingTheme.TextFontId           = textFontId;
                existingTheme.DateUpdated          = DateTime.Now;
                existingTheme.TitleLargeFontSize   = largeTitleFontSize;
                existingTheme.TitleMediumFontSize  = mediumTitleFontSize;
                existingTheme.TitleSmallFontSize   = smallTitleFontSize;
                existingTheme.TitleTinyFontSize    = tinyTitleFontSize;
                existingTheme.TextStandardFontSize = textStandardFontSize;
                existingTheme.PageBackgroundColour = pageBackgroundColour;
                existingTheme.MenuBackgroundColour = menuBackgroundColour;
                existingTheme.MenuTextColour       = menuTextColour;

                await _context.SaveChangesAsync();

                return(existingTheme.ThemeId);
            }
        }
Esempio n. 20
0
    } // End of the DirectoryExists method

    /// <summary>
    /// Check if the file exists
    /// </summary>
    /// <param name="virtualPath">The virtual path as a string</param>
    /// <returns>A boolean that indicates if the file exists</returns>
    private bool CheckIfFileExists(string virtualPath)
    {
        // Get the file name
        string fileName = Path.GetFileName(virtualPath);

        // Get the current domain
        Domain domain = Tools.GetCurrentDomain();

        // Create the theme id
        string themeId = "Theme_" + domain.custom_theme_id;

        // Get the virtual theme from cache
        Dictionary<string, string> virtualTheme = (Dictionary<string, string>)HttpContext.Current.Cache[themeId];

        // Check if the virtual theme is null
        if (virtualTheme == null)
        {
            // Add a lock to only insert once
            lock(writeLock)
            {
                // Check if the cache still is null
                if(HttpContext.Current.Cache[themeId] == null)
                {
                    // Get the virtual theme
                    virtualTheme = CustomTheme.GetAllTemplatesById(domain.custom_theme_id);

                    // Add the virtual theme to cache
                    HttpContext.Current.Cache.Insert(themeId, virtualTheme, null, DateTime.UtcNow.AddHours(13), Cache.NoSlidingExpiration, CacheItemPriority.Normal, null);
                    SetVirtualThemeHash();
                }
                else
                {
                    // Get the virtual theme from cache
                    virtualTheme = (Dictionary<string, string>)HttpContext.Current.Cache[themeId];
                }
            }
        }

        // Check if the file exists
        if (virtualTheme.ContainsKey(fileName) == true)
        {
            return true;
        }
        else
        {
            return false;
        }

    } // End of the CheckIfFileExists method
Esempio n. 21
0
 private void PogodiMe_Load(object sender, EventArgs e)
 {
     try
     {
         StreamReader sr = new StreamReader("../../theme.txt");
         LoadedTheme.odbranaTema = new CustomTheme(sr.ReadLine());
         CustomTheme momentalnaTema = LoadedTheme.odbranaTema;
         Color       backC          = System.Drawing.ColorTranslator.FromHtml(momentalnaTema.back);
         Color       btnTextC       = System.Drawing.ColorTranslator.FromHtml(momentalnaTema.btnText);
         Color       btnC           = System.Drawing.ColorTranslator.FromHtml(momentalnaTema.btn);
         if (momentalnaTema != null)
         {
             foreach (Control c in this.Controls)
             {
                 if (c is Button || c is TextBox || c is PictureBox)
                 {
                     c.BackColor = btnC;
                     c.ForeColor = btnTextC;
                     if (c is Button)
                     {
                         Button cb = (Button)c;
                         cb.FlatAppearance.MouseOverBackColor = backC;
                         cb.FlatAppearance.BorderColor        = btnTextC;
                         cb.FlatAppearance.MouseDownBackColor = btnTextC;
                     }
                 }
                 else if (c is Label)
                 {
                     c.BackColor = System.Drawing.ColorTranslator.FromHtml(momentalnaTema.back);
                     c.ForeColor = System.Drawing.ColorTranslator.FromHtml(momentalnaTema.btn);
                 }
             }
             BackColor = System.Drawing.ColorTranslator.FromHtml(momentalnaTema.back);
         }
         sr.Close();
     }
     catch (FileNotFoundException excep)
     {
     }
     if (LoadedTheme.odbranaTema == null)
     {
         b = new SolidBrush(Color.IndianRed);
     }
     else
     {
         b = new SolidBrush(System.Drawing.ColorTranslator.FromHtml(LoadedTheme.odbranaTema.btn));
     }
 }
Esempio n. 22
0
        private void ChangeThemeClick(object sender, RoutedEventArgs e)
        {
            var customTheme = new CustomTheme();

            ThemeManager.AddTheme("CT1", customTheme);

            /*
             * System.NullReferenceException HResult = 0x80004003
             *  Message = Object reference not set to an instance of an object.
             *  Source = SciChart.Charting
             *  StackTrace:
             *  at SciChart.Charting.Themes.ThemeColorProvider.wqx[c](String bzw, IDictionary bzx)
             */

            ThemeManager.SetTheme(sciChart, "CT1");
        }
Esempio n. 23
0
        public SelectTool()
        {
            orgClickTime   = DateTime.Now;
            FeatureEditors = new List <IFeatureEditor>();
            Name           = "Select";

            trackingLayer.Name = "trackers";
            FeatureCollection trackerProvider = new FeatureCollection {
                Features = trackers
            };

            trackingLayer.DataSource = trackerProvider;

            CustomTheme iTheme = new CustomTheme(GetTrackerStyle);

            trackingLayer.Theme = iTheme;
        }
Esempio n. 24
0
        public Int32 get_theme_count_by_search(string keywords = "")
        {
            // Create the string array
            string[] wordArray = new string[] { "" };

            // Recreate the array if keywords is different from null
            if (keywords != null)
            {
                wordArray = keywords.Split(' ');
            }

            // Get the count
            Int32 count = CustomTheme.GetCountBySearch(wordArray);

            // Return the count
            return(count);
        } // End of the get_theme_count_by_search method
Esempio n. 25
0
        public HttpResponseMessage delete_theme(Int32 id = 0)
        {
            // Create an error code variable
            Int32 errorCode = 0;

            // Delete the post
            errorCode = CustomTheme.DeleteOnId(id);

            // Check if there is an error
            if (errorCode != 0)
            {
                return(Request.CreateResponse <string>(HttpStatusCode.Conflict, "Foreign key constraint"));
            }

            // Return the success response
            return(Request.CreateResponse <string>(HttpStatusCode.OK, "The delete was successful"));
        } // End of the delete_theme method
Esempio n. 26
0
        private void Form1_Load(object sender, EventArgs e)
        {
            try
            {
                StreamReader sr = new StreamReader("../../theme.txt");
                LoadedTheme.odbranaTema = new CustomTheme(sr.ReadLine());
                CustomTheme momentalnaTema = LoadedTheme.odbranaTema;
                if (momentalnaTema != null)
                {
                    foreach (Control c in this.Controls)
                    {
                        if (c is Button || c is TextBox)
                        {
                            c.BackColor = System.Drawing.ColorTranslator.FromHtml(momentalnaTema.btn);
                            c.ForeColor = System.Drawing.ColorTranslator.FromHtml(momentalnaTema.btnText);
                            if (c is Button)
                            {
                                Button cb = (Button)c;
                                cb.FlatAppearance.MouseOverBackColor = System.Drawing.ColorTranslator.FromHtml(momentalnaTema.back);
                                cb.FlatAppearance.BorderColor        = System.Drawing.ColorTranslator.FromHtml(momentalnaTema.btnText);
                                cb.FlatAppearance.MouseDownBackColor = System.Drawing.ColorTranslator.FromHtml(momentalnaTema.btnText);
                            }
                        }
                        else if (c is Label)
                        {
                            c.BackColor = System.Drawing.ColorTranslator.FromHtml(momentalnaTema.back);
                            c.ForeColor = System.Drawing.ColorTranslator.FromHtml(momentalnaTema.btn);
                        }
                    }
                    BackColor = System.Drawing.ColorTranslator.FromHtml(momentalnaTema.back);
                    b         = new SolidBrush(System.Drawing.ColorTranslator.FromHtml(momentalnaTema.btn));
                }
                sr.Close();
            }
            catch (FileNotFoundException excep)
            {
            }

            Novo();
            textBox1.Select(0, 0);
            timeElapsed = 0;
            // updateTime();

            timer1.Start();
        }
Esempio n. 27
0
        public List <CustomTheme> get_themes_by_search(string keywords  = "", Int32 pageSize   = 0, Int32 pageNumber = 0,
                                                       string sortField = "", string sortOrder = "")
        {
            // Create the string array
            string[] wordArray = new string[] { "" };

            // Recreate the array if keywords is different from null
            if (keywords != null)
            {
                wordArray = keywords.Split(' ');
            }

            // Create the list to return
            List <CustomTheme> posts = CustomTheme.GetBySearch(wordArray, pageSize, pageNumber, sortField, sortOrder);

            // Return the list
            return(posts);
        } // End of the get_themes_by_search method
        public HttpResponseMessage add_theme(CustomTheme post)
        {
            // Check for errors
            if (post == null)
            {
                return Request.CreateResponse<string>(HttpStatusCode.BadRequest, "The post is null");
            }

            // Make sure that the data is valid
            post.name = AnnytabDataValidation.TruncateString(post.name, 100);

            // Add the post
            Int32 insertId = (Int32)CustomTheme.Add(post);
            CustomTheme.AddCustomThemeTemplates(insertId);

            // Return the success response
            return Request.CreateResponse<string>(HttpStatusCode.OK, "The post has been added");

        } // End of the add_theme method
Esempio n. 29
0
        public static string TestExtensionCustomThemeSerialization(ScreenManager screenMan, out int errorsAdded)
        {
            int         num         = 0;
            string      str1        = "";
            CustomTheme customTheme = new CustomTheme();
            Color       color       = new Color(22, 22, 22, 19);

            customTheme.defaultTopBarColor = color;
            string str2 = "customTheme1.xml";

            Utils.writeToFile(customTheme.GetSaveString(), str2);
            if (CustomTheme.Deserialize(str2).defaultTopBarColor != color)
            {
                ++num;
                str1 += "\nSave/Load broken for themes!";
            }
            errorsAdded = num;
            return(str1);
        }
Esempio n. 30
0
        public HttpResponseMessage add_theme(CustomTheme post)
        {
            // Check for errors
            if (post == null)
            {
                return(Request.CreateResponse <string>(HttpStatusCode.BadRequest, "The post is null"));
            }

            // Make sure that the data is valid
            post.name = AnnytabDataValidation.TruncateString(post.name, 100);

            // Add the post
            Int32 insertId = (Int32)CustomTheme.Add(post);

            CustomTheme.AddCustomThemeTemplates(insertId);

            // Return the success response
            return(Request.CreateResponse <string>(HttpStatusCode.OK, "The post has been added"));
        } // End of the add_theme method
Esempio n. 31
0
        private void SetThemeConfiguration()
        {
            if (String.IsNullOrEmpty(ThemeConfiguration))
            {
                return;
            }

            var theme        = new CustomTheme().GetThemes(ThemeConfiguration);
            var customThemes = theme as IList <CustomTheme> ?? theme.ToList();

            if (!customThemes.Any())
            {
                return;
            }
            foreach (var customTheme in customThemes.OrderBy(x => x.Priority))
            {
                var link = new CustomTheme().GetStylesheetLink(customTheme, ThemeConfiguration);
                Page.Header.Controls.Add(new LiteralControl(link));
            }
        }
Esempio n. 32
0
    } // End of the constructor

    #endregion

    #region Insert methods

    /// <summary>
    /// Add one custom theme
    /// </summary>
    /// <param name="post">A reference to a custom theme post</param>
    public static long Add(CustomTheme post)
    {
        // Create the long to return
        long idOfInsert = 0;

        // Create the connection and the sql statement
        string connection = Tools.GetConnectionString();
        string sql = "INSERT INTO dbo.custom_themes (name) VALUES (@name);SELECT SCOPE_IDENTITY();";

        // The using block is used to call dispose automatically even if there are an exception.
        using (SqlConnection cn = new SqlConnection(connection))
        {
            // The using block is used to call dispose automatically even if there are an exception.
            using (SqlCommand cmd = new SqlCommand(sql, cn))
            {
                // Add parameters
                cmd.Parameters.AddWithValue("@name", post.name);

                // The Try/Catch/Finally statement is used to handle unusual exceptions in the code to
                // avoid having our application crash in such cases
                try
                {
                    // Open the connection
                    cn.Open();

                    // Execute the insert
                    idOfInsert = Convert.ToInt64(cmd.ExecuteScalar());

                }
                catch (Exception e)
                {
                    throw e;
                }
            }
        }

        // Return the id of the inserted item
        return idOfInsert;

    } // End of the Add method
Esempio n. 33
0
    } // End of the constructor

    #endregion

    #region Insert methods

    /// <summary>
    /// Add one custom theme
    /// </summary>
    /// <param name="post">A reference to a custom theme post</param>
    public static long Add(CustomTheme post)
    {
        // Create the long to return
        long idOfInsert = 0;

        // Create the connection and the sql statement
        string connection = Tools.GetConnectionString();
        string sql = "INSERT INTO dbo.custom_themes (name) VALUES (@name);SELECT SCOPE_IDENTITY();";

        // The using block is used to call dispose automatically even if there are an exception.
        using (SqlConnection cn = new SqlConnection(connection))
        {
            // The using block is used to call dispose automatically even if there are an exception.
            using (SqlCommand cmd = new SqlCommand(sql, cn))
            {
                // Add parameters
                cmd.Parameters.AddWithValue("@name", post.name);

                // The Try/Catch/Finally statement is used to handle unusual exceptions in the code to
                // avoid having our application crash in such cases
                try
                {
                    // Open the connection
                    cn.Open();

                    // Execute the insert
                    idOfInsert = Convert.ToInt64(cmd.ExecuteScalar());

                }
                catch (Exception e)
                {
                    throw e;
                }
            }
        }

        // Return the id of the inserted item
        return idOfInsert;

    } // End of the Add method
Esempio n. 34
0
        public HttpResponseMessage add_template(CustomThemeTemplate post)
        {
            // Check for errors
            if (post == null)
            {
                return(Request.CreateResponse <string>(HttpStatusCode.BadRequest, "The post is null"));
            }
            else if (CustomTheme.MasterPostExists(post.custom_theme_id) == false)
            {
                return(Request.CreateResponse <string>(HttpStatusCode.BadRequest, "The theme does not exist"));
            }

            // Make sure that the data is valid
            post.user_file_name  = AnnytabDataValidation.TruncateString(post.user_file_name, 200);
            post.master_file_url = AnnytabDataValidation.TruncateString(post.master_file_url, 100);
            post.comment         = AnnytabDataValidation.TruncateString(post.comment, 200);

            // Add the post
            CustomTheme.AddTemplate(post);

            // Return the success response
            return(Request.CreateResponse <string>(HttpStatusCode.OK, "The post has been added"));
        } // End of the add_template method
Esempio n. 35
0
    } // End of the MasterPostExists method

    /// <summary>
    /// Get one custom theme based on id
    /// </summary>
    /// <param name="id">The id</param>
    /// <returns>A reference to a custom theme post</returns>
    public static CustomTheme GetOneById(Int32 id)
    {
        // Create the post to return
        CustomTheme post = null;

        // Create the connection and the sql statement
        string connection = Tools.GetConnectionString();
        string sql = "SELECT * FROM dbo.custom_themes WHERE id = @id;";

        // The using block is used to call dispose automatically even if there is a exception.
        using (SqlConnection cn = new SqlConnection(connection))
        {
            // The using block is used to call dispose automatically even if there is a exception.
            using (SqlCommand cmd = new SqlCommand(sql, cn))
            {
                // Add a parameters
                cmd.Parameters.AddWithValue("@id", id);

                // Create a MySqlDataReader
                SqlDataReader reader = null;

                // The Try/Catch/Finally statement is used to handle unusual exceptions in the code to
                // avoid having our application crash in such cases.
                try
                {
                    // Open the connection.
                    cn.Open();

                    // Fill the reader with one row of data.
                    reader = cmd.ExecuteReader();

                    // Loop through the reader as long as there is something to read and add values
                    while (reader.Read())
                    {
                        post = new CustomTheme(reader);
                    }
                }
                catch (Exception e)
                {
                    throw e;
                }
                finally
                {
                    // Call Close when done reading to avoid memory leakage.
                    if (reader != null)
                        reader.Close();
                }
            }
        }

        // Return the post
        return post;

    } // End of the GetOneById method
Esempio n. 36
0
    } // End of the AddTemplate method

    #endregion

    #region Update methods

    /// <summary>
    /// Update a custom theme post
    /// </summary>
    /// <param name="post">A reference to a custom theme post</param>
    public static void Update(CustomTheme post)
    {
        // Create the connection and the sql statement
        string connection = Tools.GetConnectionString();
        string sql = "UPDATE dbo.custom_themes SET name = @name WHERE id = @id;";

        // The using block is used to call dispose automatically even if there are an exception.
        using (SqlConnection cn = new SqlConnection(connection))
        {
            // The using block is used to call dispose automatically even if there are an exception.
            using (SqlCommand cmd = new SqlCommand(sql, cn))
            {
                // Add parameters
                cmd.Parameters.AddWithValue("@id", post.id);
                cmd.Parameters.AddWithValue("@name", post.name);

                // The Try/Catch/Finally statement is used to handle unusual exceptions in the code to
                // avoid having our application crash in such cases.
                try
                {
                    // Open the connection.
                    cn.Open();

                    // Execute the update
                    cmd.ExecuteNonQuery();

                }
                catch (Exception e)
                {
                    throw e;
                }
            }
        }

    } // End of the Update method
Esempio n. 37
0
    // Use this for initialization
    void Start()
    {
        System       = GameObject.Find("System");
        Applications = GameObject.Find("Applications");
        Hacking      = GameObject.Find("Hacking");
        Other        = GameObject.Find("Other");
        Computer     = GameObject.Find("Computer");
        Prompts      = GameObject.Find("Prompts");
        WindowHandel = GameObject.Find("WindowHandel");
        QA           = GameObject.Find("QA");

        winman = WindowHandel.GetComponent <WindowManager>();

        history      = Computer.GetComponent <SiteList>();
        websecviewer = Computer.GetComponent <WebSecViewer>();

        qa = QA.GetComponent <BugReport>();

        //DESKTOP ENVIROMENT
        customtheme = Computer.GetComponent <CustomTheme>();
        startmenu   = System.GetComponent <AppMenu>();
        rezprompt   = Prompts.GetComponent <RezPrompt>();
        desktop     = System.GetComponent <Desktop>();
        vc          = System.GetComponent <VolumeController>();

        //HACKING SOFTWARE
        pro             = Hacking.GetComponent <Progtive>();
        trace           = Hacking.GetComponent <Tracer>();
        dirsearch       = Hacking.GetComponent <DirSearch>();
        dicCrk          = Hacking.GetComponent <DicCrk>();
        passwordcracker = Hacking.GetComponent <PasswordCracker>();
        dirsearch       = Hacking.GetComponent <DirSearch>();

        //STOCK SYSTEMS
//		port = Applications.GetComponent<Portfolio>();
//		shareprompt = Prompts.GetComponent<SharePrompt>();

        //OTHER PROMPTS
        purchaseprompt = Prompts.GetComponent <PurchasePrompt>();

        //SYSTEM PROMPTS
        errorprompt    = Prompts.GetComponent <ErrorProm>();
        shutdownprompt = Prompts.GetComponent <ShutdownProm>();
        installprompt  = Prompts.GetComponent <InstallPrompt>();

        //SYSTEM SOFTWARE
        sysclock      = System.GetComponent <Clock>();
        cli           = System.GetComponent <CLI>();
        cliv2         = System.GetComponent <CLIV2>();
        os            = System.GetComponent <OS>();
        systempanel   = System.GetComponent <SystemPanel>();
        tasks         = System.GetComponent <TaskViewer>();
        com           = System.GetComponent <Computer>();
        diskman       = System.GetComponent <DiskMan>();
        vv            = System.GetComponent <VersionViewer>();
        fp            = System.GetComponent <FileExplorer>();
        SRM           = System.GetComponent <SystemResourceManager>();
        boot          = System.GetComponent <Boot>();
        deviceman     = System.GetComponent <DeviceManager>();
        executor      = System.GetComponent <Executor>();
        gatewayviewer = System.GetComponent <GatewayViewer>();

        //LEGAL APPLICATIONS
        email          = Applications.GetComponent <EmailClient>();
        caluclator     = Applications.GetComponent <Calculator>();
        notepad        = Applications.GetComponent <Notepad>();
        notepadv2      = Applications.GetComponent <Notepadv2>();
        accountlogs    = Applications.GetComponent <AccLog>();
        mp             = Applications.GetComponent <MusicPlayer>();
        treeview       = Applications.GetComponent <TreeView>();
        nv             = Applications.GetComponent <NotificationViewer>();
        pv             = Applications.GetComponent <PlanViewer>();
        calendar       = Applications.GetComponent <Calendar>();
        calendarv2     = Applications.GetComponent <CalendarV2>();
        eventview      = Applications.GetComponent <EventViewer>();
        exchangeviewer = Applications.GetComponent <ExchangeViewer>();

        //INTERNET BROWSERS
        internetbrowser = Applications.GetComponent <InternetBrowser>();
        edgebrowser     = Applications.GetComponent <NetViewer>();
        firefoxbrowser  = Applications.GetComponent <Firefox>();

        //APPLICATIONS
        systemMap  = Applications.GetComponent <SystemMap>();
        textreader = Applications.GetComponent <TextReader>();

        //BROWSER STUFF
        history = Computer.GetComponent <SiteList>();

        //OTHER CONNECTION DEVICE
        rv  = Applications.GetComponent <RemoteView>();
        vmd = Other.GetComponent <VMDesigner>();
    }
        public ActionResult edit_theme(FormCollection collection)
        {
            // Get the current domain
            Domain currentDomain = Tools.GetCurrentDomain();
            ViewBag.CurrentDomain = currentDomain;

            // Get query parameters
            string returnUrl = collection["returnUrl"];
            ViewBag.QueryParams = new QueryParams(returnUrl);

            // Check if the administrator is authorized
            if (Administrator.IsAuthorized(new string[] { "Administrator", "Editor" }) == true)
            {
                ViewBag.AdminSession = true;
            }
            else if (Administrator.IsAuthorized(Administrator.GetAllAdminRoles()) == true)
            {
                ViewBag.AdminSession = true;
                ViewBag.AdminErrorCode = 1;
                ViewBag.TranslatedTexts = StaticText.GetAll(currentDomain.back_end_language, "id", "ASC");
                return View("index");
            }
            else
            {
                // Redirect the user to the start page
                return RedirectToAction("index", "admin_login");
            }

            // Get form data
            Int32 id = Convert.ToInt32(collection["txtId"]);
            string name = collection["txtName"];

            // Get the theme
            CustomTheme theme = CustomTheme.GetOneById(id);

            // Check if the theme exists
            if(theme == null)
            {
                theme = new CustomTheme();
            }

            // Update values
            theme.name = AnnytabDataValidation.TruncateString(name, 100);

            // Add or update the theme
            if(id == 0)
            {
                // Add the theme
                theme.id = (Int32)CustomTheme.Add(theme);
                CustomTheme.AddCustomThemeTemplates(theme.id);
            }
            else
            {
                // Update the theme
                CustomTheme.Update(theme);
            }

            // Redirect the user to edit theme page
            return RedirectToAction("edit_theme", new { id = theme.id, returnUrl = returnUrl });

        } // End of the edit_theme method