Exemplo 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 );
                }
            }
        }
Exemplo n.º 2
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();
        }
Exemplo n.º 3
0
        private void SubEdit( Procedure Proc )
        {
            if ( !ProcChains.Contains( Proc ) )
            {
                ProcChains.Add( Proc );
            }

            PM = ( Proc as ISubProcedure ).SubProcedures;
            UpdateVisualData();
        }
Exemplo n.º 4
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 );
            }
        }
Exemplo n.º 5
0
 private void ShowProcContext( object sender, RightTappedRoutedEventArgs e )
 {
     Grid G = sender as Grid;
     FlyoutBase.ShowAttachedFlyout( G );
     SelectedItem = G.DataContext as Procedure;
 }
Exemplo n.º 6
0
        private void RemoveProcedure( object sender, RoutedEventArgs e )
        {
            if ( SelectedItem == null ) return;

            PM.RemoveProcedure( SelectedItem );
            SelectedItem = null;
        }
Exemplo n.º 7
0
 public ProcConvoy( Procedure Dispatcher, object Payload )
 {
     this.Dispatcher = Dispatcher;
     this.Payload = Payload;
 }