Пример #1
0
        public void StartCore(string filePath, Corel.Interop.VGCore.Application corelApp)
        {
            if (corelApp != null)
            {
                InCorel                      = true;
                CorelAutomation              = new CorelAutomation(corelApp, this);
                this.app                     = corelApp;
                corelApp.OnApplicationEvent += CorelApp_OnApplicationEvent;
            }
            FileInfo file = null;

            try
            {
                FileInfo fileOri = new FileInfo(filePath);
                Title = filePath;
                try
                {
                    if (!Directory.Exists(workerFolder))
                    {
                        Directory.CreateDirectory(workerFolder);
                    }
                }
                catch (IOException ioE)
                {
                    if (ErrorFound != null)
                    {
                        ErrorFound("Erro - " + ioE.Message);
                    }
                    return;
                }
                string newPath = workerFolder + "\\" + fileOri.Name;
                if (File.Exists(newPath))
                {
                    File.Delete(newPath);
                }
                file = fileOri.CopyTo(newPath);
            }
            catch (IOException ioErro)
            {
                if (ErrorFound != null)
                {
                    ErrorFound("Erro - " + ioErro.Message);
                }
                return;
            }
            inputCommands          = new InputCommands(this);
            commands               = (typeof(InputCommands)).GetMethods(BindingFlags.Public | BindingFlags.Instance);
            xmlDecoder             = new XMLDecoder();
            xmlDecoder.LoadFinish += XmlDecoder_LoadFinish;
            Thread thread = new Thread(new ParameterizedThreadStart(LoadFile));

            thread.IsBackground = true;
            thread.Start(file);
        }
Пример #2
0
 public DetailsViewModel(Core core) : base(core)
 {
     corelAutomation   = new CorelAutomation(core.CorelApp, core);
     this.core         = core;
     corelApp          = core.CorelApp;
     RunBindCommand    = new ViewModels.Commands.AttributeCommand(attributeContentExec, attributeContentCanExec);
     RunMacroCommand   = new ViewModels.Commands.AttributeCommand(attributeMacro, attributeCanMacro);
     SearchGuidCommand = new ViewModels.Commands.AttributeCommand(attributeSearchGuid, attributeCanSearchGuid);
     SearchItemCommand = new ViewModels.Commands.AttributeCommand(attributeSearchItem, attributeCanSearchItem);
     CopyCommand       = new ViewModels.Commands.AttributeCommand(attributeCopy, attributeCanCopy);
 }
 public void StartProcess(string filePath)
 {
     //treeView_Nodes.Items.Clear();
     //treeView_Search.Items.Clear();
     msgCount         = 1;
     dataContext      = new XMLTagWindowViewModel(core);
     this.DataContext = dataContext;
     core.StartCore(filePath, this.app);
     dataContext.Title                 = filePath;
     corelCmd                          = new CorelAutomation(this.app, core);
     dataContext.CorelCmd              = corelCmd;
     core.LoadXmlFinish               += Core_LoadFinish;
     core.FilePorcentLoad             += Core_FilePorcentLoad;
     core.LoadListsFinish             += Core_LoadListsFinish;
     core.LoadStarting                += Core_LoadStarting;
     core.ErrorFound                  += Core_ErrorFound;
     core.SearchResultEvent           += Core_SearchResultEvent;
     core.LoadFinish                  += Core_LoadFinish1;
     core.NewMessage                  += Core_NewMessage;
     core.RequestUIHideVisibleChanged += Core_RequestUIHideVisibleChanged;
     dataContext.InCorel               = core.InCorel;
     //treeView_Nodes.GotFocus += (s, e) => { if (treeView_Nodes.SelectedItem != null) UpdateDetails(treeView_Nodes.SelectedItem, e); };
     //treeView_Ref.GotFocus += (s, e) => { if (treeView_Ref.SelectedItem != null) UpdateDetails(treeView_Ref.SelectedItem, e); };
     //treeView_Search.GotFocus += (s, e) => { if (treeView_Search.SelectedItem != null) UpdateDetails(treeView_Search.SelectedItem, e); };
     treeView_Nodes.SelectedItemChanged += (s, e) => { if (treeView_Nodes.SelectedItem != null)
                                                       {
                                                           UpdateDetails(treeView_Nodes.SelectedItem, e);
                                                       }
     };
     treeView_Ref.SelectedItemChanged += (s, e) => { if (treeView_Ref.SelectedItem != null)
                                                     {
                                                         UpdateDetails(treeView_Ref.SelectedItem, e);
                                                     }
     };
     treeView_Search.SelectedItemChanged += (s, e) => { if (treeView_Search.SelectedItem != null)
                                                        {
                                                            UpdateDetails(treeView_Search.SelectedItem, e);
                                                        }
     };
     dataContext.XmlDecode += DataContext_XmlDecode;
     inputControl.Core      = core;
     saveLoad = new SaveLoadConfig();
 }