Esempio n. 1
0
 public override bool openOrder( PlataDM.Skola skola )
 {
     var strPath = lst.SelectedItem as string;
     if ( strPath == null )
         return false;
     skola.Open( strPath );
     skola.ReadOnly = Form.ModifierKeys != Keys.Control;
     return true;
 }
Esempio n. 2
0
 public override bool openOrder( PlataDM.Skola skola )
 {
     if ( _fRestoreBackup )
     {
         string strSrc = ug.selectedRowTag as string;
         string strDst = Path.Combine( Global.Preferences.MainPath, Path.GetFileName( strSrc ) );
         if ( FBackup.showDialog(
             this.FindForm(),
             true,
             string.Format( "Återställ {0}", ug.selectedDataRow.Cells[1].Value ),
             strSrc,
             strDst ) != DialogResult.OK )
             return false;
         skola.Open( strDst );
         return true;
     }
     else
     {
         skola.Open( selectedPath );
         if ( _fImport )
             return true;
         Directory.CreateDirectory( Path.Combine( selectedPath, "cache" ) );
         if ( skola.Verifierad || File.Exists( Path.Combine( skola.HomePath, "zzlast" ) ) )
             if ( Form.ModifierKeys != (Keys.Control | Keys.Shift) )
             {
                 skola.ReadOnly = true;
                 Global.showMsgBox( this, "Eftersom denna order är färdigställd så öppnas den i skrivskyddat läge!" );
             }
         return true;
     }
 }
Esempio n. 3
0
        public override bool openOrder(PlataDM.Skola skola)
        {
            if ( lvWorks.SelectedItems.Count!=1 )
                return false;
            RecoveryInfo ri = lvWorks.SelectedItems[0].Tag as RecoveryInfo;
            if ( ri==null )
                return false;

            ArrayList alPossibleFiles = new ArrayList();
            if ( ri.fHasWorkingXml )
                alPossibleFiles.Add( new SortableFileInfo(ri.strXml) );
            if ( ri.fHasWorkingBk1 )
                alPossibleFiles.Add( new SortableFileInfo(ri.strBk1) );
            if ( ri.fHasWorkingBk2 )
                alPossibleFiles.Add( new SortableFileInfo(ri.strBk2) );

            alPossibleFiles.Sort();

            foreach ( SortableFileInfo sfi in alPossibleFiles )
                try
                {
                    skola.Open( Path.GetDirectoryName(sfi.FileName), sfi.FileName );
                    if ( skola.Namn.Length!=0 )
                    {
                        skola.save(null);
                        return true;
                    }
                }
                catch ( Exception ex )
                {
                    Global.showMsgBox( this, ex.ToString() );
                }
            return false;
        }