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 ); } } }
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 void SubEdit( Procedure Proc ) { if ( !ProcChains.Contains( Proc ) ) { ProcChains.Add( Proc ); } PM = ( Proc as ISubProcedure ).SubProcedures; 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 ShowProcContext( object sender, RightTappedRoutedEventArgs e ) { Grid G = sender as Grid; FlyoutBase.ShowAttachedFlyout( G ); SelectedItem = G.DataContext as Procedure; }
private void RemoveProcedure( object sender, RoutedEventArgs e ) { if ( SelectedItem == null ) return; PM.RemoveProcedure( SelectedItem ); SelectedItem = null; }
public ProcConvoy( Procedure Dispatcher, object Payload ) { this.Dispatcher = Dispatcher; this.Payload = Payload; }