Esempio n. 1
0
        protected override void OnNavigatedTo( NavigationEventArgs e )
        {
            base.OnNavigatedTo( e );
            NavigationHandler.InsertHandlerOnNavigatedBack( StepSubProcedures );
            MessageBus.OnDelivery += MessageBus_OnDelivery;

            if ( e.Parameter != null )
            {
                string OpeningFile = ( string ) e.Parameter;

                RootManager = PM = new ProcManager();
                ProcChains.Clear();
                SelectedItem = null;
                UpdateVisualData();
                try
                {
                    ProcManager.PanelMessage( ID, Res.SSTR( "Reading", OpeningFile ), LogType.INFO );
                    ReadProcedures( OpeningFile );
                    ProcManager.PanelMessage( ID, () => Res.RSTR( "ParseOK" ), LogType.INFO );

                    UpdateVisualData();
                    TargetFile = OpeningFile;
                }
                catch ( Exception ex )
                {
                    ProcManager.PanelMessage( ID, ex.Message, LogType.ERROR );
                    ProcManager.PanelMessage( ID, () => Res.RSTR( "InvalidXML" ), LogType.ERROR );
                }
            }
        }
Esempio n. 2
0
        public bool Open( XRegistry ZDef )
        {
            IsLoading = true;

            try
            {
                XParameter Param = ZDef.Parameter( "Procedures" );
                PM = new ProcManager( Param );
                NotifyChanged( "ProcList" );

                SetBanner();

                return true;
            }
            catch( InvalidFIleException )
            {
                ProcManager.PanelMessage( ID, () => Res.RSTR( "InvalidXML" ), LogType.ERROR );
            }
            catch( Exception ex )
            {
                Logger.Log( ID, ex.Message, LogType.ERROR );
            }
            finally
            {
                IsLoading = false;
            }

            return false;
        }
Esempio n. 3
0
 public WenkuMarker()
     :base( ProcType.MARK )
 {
     VolProcs = new ProcManager();
     EpProcs = new ProcManager();
 }
Esempio n. 4
0
        public override void ReadParam( XParameter Param )
        {
            base.ReadParam( Param );

            VolTitle = Param.GetValue( "VolTitle" );
            VolPattern = Param.GetValue( "VolPattern" );
            VolParam = Param.GetValue( "VolParam" );
            EpTitle = Param.GetValue( "EpTitle" );
            EpPattern = Param.GetValue( "EpPattern" );
            EpParam = Param.GetValue( "EpParam" );

            VolProcs = new ProcManager( Param.Parameter( "VolProcs" ) );
            EpProcs = new ProcManager( Param.Parameter( "EpProcs" ) );
        }
Esempio n. 5
0
        private void SubEdit( Procedure Proc )
        {
            if ( !ProcChains.Contains( Proc ) )
            {
                ProcChains.Add( Proc );
            }

            PM = ( Proc as ISubProcedure ).SubProcedures;
            UpdateVisualData();
        }
Esempio n. 6
0
        private void StepSubProcedures( object sender, XBackRequestedEventArgs e )
        {
            if ( 0 < ProcChains.Count )
            {
                e.Handled = true;

                SelectedItem = ProcChains.Last();
                EditProcedure();

                ProcChains.Remove( SelectedItem );

                if ( 0 < ProcChains.Count )
                {
                    SubEdit( ProcChains.Last() );
                    return;
                }
            }

            if( !e.Handled )
            {
                Dispose();
                return; 
            }

            PM = RootManager;
            UpdateVisualData();
        }
Esempio n. 7
0
        private async void OpenProcedures( object sender, RoutedEventArgs e )
        {
            bool Yes = false;

            StringResources stx = new StringResources( "/libtaotu/Message" );
            MessageDialog Msg = new MessageDialog( stx.Str( "ConfirmDiscard" ) );
            Msg.Commands.Add( new UICommand( stx.Str( "Yes" ), x => Yes = true ) );
            Msg.Commands.Add( new UICommand( stx.Str( "No" ) ) );

            await Popups.ShowDialog( Msg );

            if ( !Yes ) return;
            RootManager = PM = new ProcManager();
            ProcChains.Clear();
            SelectedItem = null;
            UpdateVisualData();

            try
            {
                // Remove the file
                new AppStorage().DeleteFile( TargetFile );

                IStorageFile ISF = await AppStorage.OpenFileAsync( ".xml" );
                if ( ISF == null ) return;

                ProcManager.PanelMessage( ID, Res.RSTR( "Reading", ISF.Name ), LogType.INFO );
                ReadXReg( new XRegistry( await ISF.ReadString(), TargetFile ) );
                ProcManager.PanelMessage( ID, () => Res.RSTR( "ParseOK" ), LogType.INFO );

                UpdateVisualData();
            }
            catch( Exception ex )
            {
                ProcManager.PanelMessage( ID, ex.Message, LogType.ERROR );
                ProcManager.PanelMessage( ID, () => Res.RSTR( "InvalidXML" ), LogType.ERROR );
            }
        }
Esempio n. 8
0
        private void SetTemplate()
        {
            StringResources stx = new StringResources( "/libtaotu/ProcItems" );
            Dictionary<ProcType, string> ProcChoices = new Dictionary<ProcType, string>();

            Type PType = typeof( ProcType );
            foreach ( ProcType P in Enum.GetValues( PType ) )
            {
                string ProcName = stx.Str( Enum.GetName( PType, P ) );

                if ( string.IsNullOrEmpty( ProcName ) ) continue;

                ProcChoices.Add( P, ProcName );
            }

            RootManager = new ProcManager();
            ProcComboBox.ItemsSource = ProcChoices;
            RunLog.ItemsSource = Logs;

            ProcManager.PanelMessage( ID, () => Res.RSTR( "Welcome" ), LogType.INFO );

            Logs.CollectionChanged += ( s, e ) => ScrollToBottom();

            PM = RootManager;

            ReadProcedures( TargetFile );
            UpdateVisualData();
        }
Esempio n. 9
0
        public override void ReadParam( XParameter Param )
        {
            base.ReadParam( Param );

            ItemPattern = Param.GetValue( "ItemPattern" );
            ItemParam = Param.GetValue( "ItemParam" );
            BannerPath = Param.GetValue( "Banner" );

            ItemProcs = new ProcManager( Param.Parameter( "ItemProcs" ) );
            BookSpider = new ProcManager( Param.Parameter( "BookSpider" ) );
        }
Esempio n. 10
0
 public WenkuListLoader()
     : base( ProcType.LIST )
 {
     ItemProcs = new ProcManager();
     BookSpider = new ProcManager();
 }
Esempio n. 11
0
 public void ImportSpider( XParameter SpiderDef )
 {
     ProcManager PM = new ProcManager( SpiderDef );
     BookSpider = PM;
     NotifyChanged( "HasBookSpider" );
 }