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 );
                }
            }
        }
Beispiel #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;
        }
Beispiel #3
0
 public WenkuMarker()
     :base( ProcType.MARK )
 {
     VolProcs = new ProcManager();
     EpProcs = new ProcManager();
 }
Beispiel #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" ) );
        }
        private void SubEdit( Procedure Proc )
        {
            if ( !ProcChains.Contains( Proc ) )
            {
                ProcChains.Add( Proc );
            }

            PM = ( Proc as ISubProcedure ).SubProcedures;
            UpdateVisualData();
        }
        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();
        }
        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 );
            }
        }
        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();
        }
Beispiel #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" ) );
        }
Beispiel #10
0
 public WenkuListLoader()
     : base( ProcType.LIST )
 {
     ItemProcs = new ProcManager();
     BookSpider = new ProcManager();
 }
Beispiel #11
0
 public void ImportSpider( XParameter SpiderDef )
 {
     ProcManager PM = new ProcManager( SpiderDef );
     BookSpider = PM;
     NotifyChanged( "HasBookSpider" );
 }