コード例 #1
0
        public FilePropertyWidget(FilePropertisData fpd)
        {
            Project project = fpd.Project;

            fiOld = project.FilesProperty.Find(x => x.SystemFilePath == fpd.Filename);
            if (fiOld == null)
            {
                fiOld = new FileItem(fpd.Filename, false);
                project.FilesProperty.Add(fiOld);
            }
            if (fiOld.ConditionValues == null)
            {
                fiOld.ConditionValues = new System.Collections.Generic.List <ConditionRule>();
            }

            string fullPath = MainClass.Workspace.GetFullPath(fiOld.FilePath);

            string   size = "0";
            FileInfo fi   = new FileInfo(fullPath);

            if (fi.Exists)
            {
                size = ((int)(fi.Length / 1024)).ToString() + " KB";
            }

            Table mainTable     = new Table(4, 1, false);
            Table propertyTable = new Table(5, 2, false);

            Label lblFN = GetLabel(System.IO.Path.GetFileName(fiOld.SystemFilePath)); //new Label(System.IO.Path.GetFileName(fiOld.SystemFilePath));
            Label lblSZ = GetLabel(System.IO.Path.GetFileName(size));                 // new Label(System.IO.Path.GetFileName(size));

            Entry entr = new Entry(fiOld.SystemFilePath);

            entr.IsEditable = false;

            Entry entrFullPath = new Entry(fullPath);

            entrFullPath.IsEditable = false;

            Label lblPrj = GetLabel(project.ProjectName);           // new Label(project.ProjectName);


            CheckButton chbExclude = new CheckButton("");

            chbExclude.Active = fiOld.IsExcluded;

            chbExclude.Clicked += delegate(object sender, EventArgs e)
            {
                fiOld.IsExcluded = chbExclude.Active;
            };

            AddControl(ref propertyTable, 0, lblFN, "Name ");
            AddControl(ref propertyTable, 1, lblSZ, "Size ");
            AddControl(ref propertyTable, 2, entr, "Relative Path ");
            AddControl(ref propertyTable, 3, entrFullPath, "Full Path ");
            AddControl(ref propertyTable, 4, lblPrj, "Project ");
            AddControl(ref propertyTable, 5, chbExclude, "Exclude ");

            int   rowCount        = project.ConditoinsDefine.Count;
            Table conditionsTable = new Table((uint)(rowCount + 3), (uint)2, false);

            GenerateContent(ref conditionsTable, MainClass.Settings.Platform.Name, 1, MainClass.Settings.Platform, false);           //tableSystem
            GenerateContent(ref conditionsTable, MainClass.Settings.Resolution.Name, 2, MainClass.Settings.Resolution, true);        //project.Resolution);//tableSystem
            int i = 3;

            foreach (Condition cd in project.ConditoinsDefine)
            {
                GenerateContent(ref conditionsTable, cd.Name, i, cd, false);
                i++;
            }

            Expander exp1 = new Expander("General");

            exp1.Expanded = true;
            exp1.Add(propertyTable);

            Expander exp2 = new Expander("Conditions");

            exp2.Expanded = true;
            exp2.Add(conditionsTable);

            mainTable.Attach(exp1, 0, 1, 0, 1, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Fill, 0, 0);
            mainTable.Attach(exp2, 0, 1, 1, 2, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Fill, 0, 0);

            string extension = System.IO.Path.GetExtension(fpd.Filename);

            switch (extension)
            {
            case ".png":
            case ".jpg":
            case ".jpeg":
            case ".bmp":
            case ".gif":
            case ".tif":
            case ".svg": {
                Table ImageTable = GenerateImageControl();
                if (ImageTable != null)
                {
                    Expander expImage = new Expander("Image");
                    expImage.Expanded = true;
                    expImage.Add(ImageTable);
                    mainTable.Attach(expImage, 0, 1, 2, 3, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Fill, 0, 0);
                }
                break;
            }

            case ".db":
                //
                break;

            default:
                //
                break;
            }


            this.PackStart(mainTable, true, true, 0);
            this.ShowAll();
        }
コード例 #2
0
        public DirPropertyWidget(FilePropertisData fpd)
        {
            project = fpd.Project;
            fiOld   = project.FilesProperty.Find(x => x.SystemFilePath == fpd.Filename);
            if (fiOld == null)
            {
                fiOld             = new FileItem(fpd.Filename, false);
                fiOld.IsDirectory = true;
                project.FilesProperty.Add(fiOld);
            }
            if (fiOld.ConditionValues == null)
            {
                fiOld.ConditionValues = new System.Collections.Generic.List <ConditionRule>();
            }


            Table mainTable     = new Table(2, 1, false);
            Table propertyTable = new Table(5, 2, false);

            Label lblFN = GetLabel(System.IO.Path.GetFileName(fiOld.SystemFilePath));            // new Label(System.IO.Path.GetFileName(fiOld.SystemFilePath));

            Entry entr = new Entry(fiOld.SystemFilePath);

            entr.IsEditable = false;

            Entry entrFullPath = new Entry(MainClass.Workspace.GetFullPath(fiOld.SystemFilePath));

            entrFullPath.IsEditable = false;

            Label lblPrj = GetLabel(project.ProjectName);             //new Label(project.ProjectName);

            AddControl(ref propertyTable, 0, lblFN, "Name ");
            AddControl(ref propertyTable, 1, entr, "Relative Path ");
            AddControl(ref propertyTable, 2, entrFullPath, "Full Path ");
            AddControl(ref propertyTable, 3, lblPrj, "Project ");

            int   rowCount        = project.ConditoinsDefine.Count;
            Table conditionsTable = new Table((uint)(rowCount + 3), (uint)2, false);

            GenerateContent(ref conditionsTable, MainClass.Settings.Platform.Name, 1, MainClass.Settings.Platform, false);           //tableSystem
            GenerateContent(ref conditionsTable, MainClass.Settings.Resolution.Name, 2, MainClass.Settings.Resolution, true);        //project.Resolution);//tableSystem
            int i = 3;

            foreach (Condition cd in project.ConditoinsDefine)
            {
                GenerateContent(ref conditionsTable, cd.Name, i, cd, false);
                i++;
            }
            Expander exp1 = new Expander("General");

            exp1.Expanded = true;
            exp1.Add(propertyTable);

            Expander exp2 = new Expander("Conditions");

            exp2.Expanded = true;
            exp2.Add(conditionsTable);

            mainTable.Attach(exp1, 0, 1, 0, 1, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Fill, 0, 0);
            mainTable.Attach(exp2, 0, 1, 1, 2, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Fill, 0, 0);

            this.PackStart(mainTable, true, true, 0);
            this.ShowAll();
        }