Пример #1
0
            public void OpenDirectory(WorkWindow workWindow)
            {
                string backPath = null;

                if (!IsDrive(workWindow.activePath))
                {
                    backPath = "...";
                }

                DirectoryInfo children = new DirectoryInfo(workWindow.activePath);

                DirectoryInfo[] childrenDirs = children.GetDirectories();

                workWindow.dirs.Items.Clear();
                if (backPath != null)
                {
                    workWindow.dirs.Items.Add(backPath);
                }
                workWindow.dirs.Items.AddRange(childrenDirs);

                workWindow.FilterFiles();

                Director            director = new Director();
                EventManagerBuilder movingEventManagerBuilder = new MovingEventManagerBuilder();

                director.SetEventManagerBuilder(movingEventManagerBuilder);
                director.ConstructEventManager("Was opened " + workWindow.activePath);
                EventManager eventManager = director.GetEventManager();

                AddEventManager(eventManager.ToString());
            }
Пример #2
0
            public void OpenFile(string activePath)
            {
                try
                {
                    FileInfo fi = new FileInfo(activePath);

                    Director            director = new Director();
                    EventManagerBuilder movingEventManagerBuilder = new MovingEventManagerBuilder();
                    director.SetEventManagerBuilder(movingEventManagerBuilder);
                    director.ConstructEventManager("Was opened " + activePath);
                    EventManager eventManager = director.GetEventManager();
                    AddEventManager(eventManager.ToString());

                    TextEditor te = new TextEditor(fi);
                    te.ShowDialog();

                    movingEventManagerBuilder = new MovingEventManagerBuilder();
                    director.SetEventManagerBuilder(movingEventManagerBuilder);
                    director.ConstructEventManager("Was  " + activePath);
                    eventManager = director.GetEventManager();
                    AddEventManager(eventManager.ToString());
                }
                catch (Exception e)
                {
                    Director            director = new Director();
                    EventManagerBuilder errorEventManagerBuilder = new ErrorEventManagerBuilder();
                    director.SetEventManagerBuilder(errorEventManagerBuilder);
                    director.ConstructEventManager(e.Message);
                    EventManager eventManager = director.GetEventManager();
                    AddEventManager(eventManager.ToString());

                    ErrorMessage errorMessage = new ErrorMessage(e.Message);
                    errorMessage.ShowDialog();
                }
            }