示例#1
0
        //TODO: Json File 정보를 조합하여, 이미지를 만들어 반영해야 한다.
        public MemoElement(TabCtrl control, string path, Action hide) : base(control, path)
        {
            InitializeComponent();

            this.Item              = Button_Memo;
            this.Item.DoubleClick += Item_DoubleClick;
            this.Item.KeyDown     += Item_KeyDown;

            this.Title      = Label_Title;
            this.Title.Text = Path.GetFileNameWithoutExtension(this.RootPath);

            //Json 파일에서 Image 파일을 생성하는 과정

            //바쁜 대기라, 매우 나쁜 코드지만 더 나은 코드가 생각나지 않는다.
            bool   isReady = false;
            string json    = string.Empty;

            while (!isReady)
            {
                try
                {
                    json    = File.ReadAllText(this.RootPath);
                    isReady = true;
                }
                catch (Exception e)
                {
                    Console.WriteLine("Busy Wait Error!\n\t" + e.StackTrace);
                    //isReady = false;
                }
            }
            //Json 정보 해석
            JsonSerializerSettings settings = new JsonSerializerSettings {
                TypeNameHandling = TypeNameHandling.All
            };
            List <JsonObject> objects = JsonConvert.DeserializeObject <List <JsonObject> >(json, settings);

            foreach (JsonObject obj in objects)
            {
                if (obj is Thumbnail)
                {
                    //Thumbnail 정보를 찾아, Element의 이미지로 세팅
                    Thumbnail thumbnail = obj as Thumbnail;
                    this.Item.BackgroundImage       = NemonicApp.ByteToImage(thumbnail.image);
                    this.Item.BackgroundImageLayout = ImageLayout.Zoom;
                }
            }

            this.HideSettings = hide;
        }
        public TemplateElement(TabCtrl control, string path, Action hide) : base(control, path)
        {
            InitializeComponent();
            this.Item = Button_Template;

            this.Item.DoubleClick          += Item_DoubleClick;
            this.Item.KeyDown              += Item_KeyDown;
            this.Item.BackgroundImage       = NemonicApp.GetImage(this.RootPath);
            this.Item.BackgroundImageLayout = ImageLayout.Zoom;

            this.Title      = Label_Title;
            this.Title.Text = Path.GetFileNameWithoutExtension(this.RootPath);

            this.HideSettings = hide;
        }
        public FolderElement(TabCtrl control, string path) : base(control, path)
        {
            InitializeComponent();
            this.Item = Button_Folder;

            this.Item.DoubleClick += Item_DoubleClick;

            this.Title = Label_Title;
            if (this.RootPath.Equals(NemonicApp.TemplatePath) || this.RootPath.Equals(NemonicApp.MemoPath))
            {
                this.Title.Text = "Show all";
            }
            else
            {
                this.Title.Text = new DirectoryInfo(this.RootPath).Name;
            }
        }
示例#4
0
 public Element(TabCtrl control, string path)
 {
     this.TabControl = control;
     this.RootPath   = path;
 }